![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
What does .)1 do?
Hi!
Can someone tell me what does the '.)1' (highlighted in bold and between the two awk scripts) do? Guess it connects the two scripts but what is the reason or logic behind this syntax? #!/bin/awk -f BEGIN { # change the record separator from newline to nothing RS="" # change the field separator from whitespace to newline FS="n" } { # print the second and third line of the file print $2, $3; } .)l #!/bin/awk -f # reports which file is being read BEGIN { f=""; } { if (f != FILENAME) { print "reading", FILENAME; f=FILENAME; } print; } |
|
||||
|
It's not AWK syntax. It appears that you have two awk scripts merged into one and some garbage in between them. The "#!/bin/awk -f" line is supposed to be the first line of the script and tells UNIX where awk can be found and provides for the script to be run as a standalone executable.
|
|
||||
|
Hello Guys,
I was just wondering what would be use of changing RS and FS and printing the out put. I am new to unix and going thur all the posts to learn more . If some one can give example for the use of it would be gr8t. Cheers nilesh |
|
||||
|
the default field separator is space and the default record (line) separator is the newline character. Now, if u remove the record separator and put the field separator as the newline character, then everyline will become a field.
So $1 will refer to the first line and not the first word. this is useful when u want to get particular lines and not just particular words. |
| Sponsored Links | ||
|
|