What does .)1 do?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers What does .)1 do?
# 1  
Old 10-26-2006
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;
}
# 2  
Old 10-26-2006
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.
# 3  
Old 10-30-2006
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
# 4  
Old 10-30-2006
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.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question