------------------------------------------------------------------------ nl: number lines in existing file ------------------------------------------------------------------------ numbers each non-blank (by default) lines in a file. $ nl -v STARTNUMBER -i INCREMENT -s SEPERATOR -w WIDTH -b STYLE -f FORMAT InputFile All parameters are optional STARTNUMBER: starting number default [1] INCREMENT: increment [1] WIDTH: number of columns for number [6] SEPARATOR: string which separates number from the rest of the line [tab] FORMAT: ln (left justified) rn (right justified, leading blanks) [default] rz (right justified, leading zeros) STYLE: a number all lines n number no lines t number only non-empty lines pBRE number lines that match a basic regular expression $ cat HelloKitty Hello My Name is Kitty Honestly Kitty! $ nl HelloKitty 1 Hello 2 My 3 Name is 4 Kitty 5 Honestly Kitty! $ nl -i 3 HelloKitty 1 Hello 4 My 7 Name is 10 Kitty 13 Honestly Kitty! $ nl -s ". " HelloKitty 1. Hello 2. My 3. Name is 4. Kitty 5. Honestly Kitty! $ nl -bp"Kitty" HelloKitty Hello My Name is 1 Kitty 2 Honestly Kitty! ------------------------------------------------------------------------ For fun ------------------------------------------------------------------------ $ sed '=' infile | xargs -n 2 #using sed $ awk '{print NR, $0}' infile #using awk $ grep -n ".*" infile | sed 's/:/ /' #using grep