![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 2 | 03-17-2009 01:17 AM |
| invoking a shell script inside cgi shell script | smriti_shridhar | Shell Programming and Scripting | 2 | 07-09-2008 01:50 AM |
| Accessing variables of one shell script in another shell script | looza | Shell Programming and Scripting | 2 | 06-30-2008 07:13 PM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 05:19 AM |
| How to Run a shell script from Perl script in Parent shell? | hifake | Shell Programming and Scripting | 16 | 08-28-2007 08:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need help with shell script
All,
I need some help with a shell script that is supposed to look in a text file. In that text file, fields are separated between accolades (starting with { and ending with }). I want to loop through the fields in the file, and look into each field to find a specific value. I have found that AWK has a field separator function, but this when i fill in the Field separater "{" it gives me the wrong result. The text file looks like this: Code:
{{This is the first field}{This is the second field}{This is the third
field}{Fourth}{Fifth}}
Last edited by zaxxon; 3 Weeks Ago at 05:24 AM.. Reason: use code tags please |
|
||||
|
Something like this:
Code:
awk -F "[{}]" '{
if($3==".."){...} # If field 1 == "..." do something
if($5==".."){...} # If field 2 == "..." do something
.
.
}' RS= textfile
Unix Tutorials/Programming Tutorials/Shell Scripting Tutorials |
![]() |
| Bookmarks |
| Tags |
| awk, field separator, shell |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|