Artificial intelligent assistant

How to add line numbers in every line using shell command? My file, PSS-A (Primary A) PSS-B (Primary B) PSS-C (Primary C) PSS-D (Primary D) PSS-E (Primary E) PSS-F (Primary F) PSS-G (Primary G) PSS-H (Primary H) PSS-I (Primary I) SPARE (SPARE) Output file, 1> PSS-A (Primary A) 2> PSS-B (Primary B) 3> PSS-C (Primary C) 4> PSS-D (Primary D) 5> PSS-E (Primary E) 6> PSS-F (Primary F) 7> PSS-G (Primary G) 8> PSS-H (Primary H) 9> PSS-I (Primary I) 10> SPARE (SPARE)

If you want the same format that you have specified


awk '{print NR "> " $s}' inputfile > outputfile


otherwise, though not standard, most implementations of the `cat` command can print line numbers for you (numbers padded to width 6 and followed by TAB in at least the GNU, busybox, Solaris and FreeBSD implementations).


cat -n inputfile > outputfile


Or you can use `grep -n` (numbers followed by `:`) with a regexp like `^` that matches any line:


grep -n '^' inputfile > outputfile

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ac36a72f9f1e57c82b0ea6db92e864e7