|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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 !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Little Trouble Understanding some code...
Couple of questions as I try to decipher someones code who left...
What would something coded like this do? IFS=: grep FIELD1 /Path/Path2/Param.fle | read LBL1 LBL2 USRID EADR SUBJ SERVERNAME CFGTBL DIR ERR=0 Param.fle contents.. FIELD1:FEI::FIELD2:dATAFIELD BATCH:MAIN SERVER......etc.. |
| Sponsored Links |
|
|
|
|||
|
IFS=: makes a colon the default field separator. By grep FIELD1, the code only finds records with the word "FIELD1" in them, probably just one record.
Next, since IFS is a colon, each of the variables in the read statement will be assigned the value of the corresponding field in the file. LBL1 will be the first field, ie., FIELD1 LBL2 will be the second FEI and so on. You now have several variables defined as the contents of the fields in one record from Param.fle |
|
|||
|
I got you up to LBL2, so then USRID is going to be blank because of the '::' after FEI which if I'm understanding correctly is null since there is nothing in between the colons?
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how i prepare a c++ code(c code) for implementing my own protocol format | amitpansuria | Programming | 1 | 09-07-2007 12:09 AM |
| Understanding this Makefile | the_learner | Programming | 5 | 06-14-2007 02:55 AM |
| Understanding traceroutes | Bobby | IP Networking | 2 | 03-14-2005 05:35 PM |
| need further understanding of init.d | jigarlakhani | UNIX for Advanced & Expert Users | 1 | 09-20-2002 04:11 PM |