SyntaxFix
Write A Post
Hire A Developer
Questions
🔍
[awk] Print line numbers starting at zero using awk
Home
Question
Print line numbers starting at zero using awk
NR starts at 1, so use
awk '{print NR-1 "," $0}'
Examples related to
awk
•
What are NR and FNR and what does "NR==FNR" imply?
•
awk - concatenate two string variable and assign to a third
•
Printing column separated by comma using Awk command line
•
Insert multiple lines into a file after specified pattern using shell script
•
cut or awk command to print first field of first row
•
How to run an awk commands in Windows?
•
Linux bash script to extract IP address
•
Print line numbers starting at zero using awk
•
Trim leading and trailing spaces from a string in awk
•
Use awk to find average of a column