|
Number lines in a file AWK
|
|
01-11-2010, 09:13 AM
(This post was last modified: 01-11-2010 09:17 AM by codecaine.)
Post: #1
|
|||
|
|||
|
Number lines in a file AWK
lineNumber is global variable because its in the begin section. For each line lineNumber is incremented by 1. then I just made a simple printf statement printing the line count and the entire line. If you save the filename as myscript you can execute the program like this. Remember you must my shell scripts executable chmod 755 myscript
Code: #!/bin/bashOf course you can use cat in BASH to do the exact same thing. Each line is tabbed at the beginning though. Code: cat -n /etc/passwd |
|||
|
01-11-2010, 08:25 PM
Post: #2
|
|||
|
|||
|
RE: Number lines in a file AWK
This is almost the same as in C++.
It is interesting how it outputs it in a file ! There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
« Next Oldest | Next Newest »
|





