The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-26-2006
napolayan napolayan is offline
Registered User
  
 

Join Date: Oct 2006
Location: Bangalore, India
Posts: 41
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 (permalink)  
Old 10-26-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
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 (permalink)  
Old 10-30-2006
nilesrex nilesrex is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 43
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 (permalink)  
Old 10-30-2006
napolayan napolayan is offline
Registered User
  
 

Join Date: Oct 2006
Location: Bangalore, India
Posts: 41
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0