![]() |
|
|
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 |
| string deletion, variable contents, fixed delimiters | rebelbuttmunch | Shell Programming and Scripting | 2 | 03-24-2009 07:44 AM |
| script not working...select utility | mobydick | Shell Programming and Scripting | 6 | 05-08-2008 07:33 AM |
| Encountered error! | puspendu | UNIX Benchmarks | 0 | 09-07-2006 05:37 AM |
| Newline character not working for ksh | sanikv | Shell Programming and Scripting | 11 | 06-23-2005 02:34 PM |
| 554 Unallowed chars encountered | abibbens | UNIX for Advanced & Expert Users | 1 | 01-29-2002 01:21 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
select contents between two delimiters (not working if newline in encountered)
Hi, I am facing difficulties in selecting the contents between two delimiters when there is a new line occurs.. Eg: Code:
>more sample.txt abcd -- this is the first line % efgh-- this is the second line and not able to print % ijkl -- this is the 3rd line % when i search for abcd and use the below command , i am able to print the desired contents between '--' and '%'. But the same i am not able to print in the case of 'efgh' . Its only printing the 1st line of that word found. pls tell me what correction to be included in this code.. or suggest me the code for this . Code:
grep -w efgh sample.txt | awk -F"-" '{print $2}' | awk -F"||" '{print $1}'
Required output : this is the second line and not able to print thanks in advance. :-)
Last edited by Balaji PK; 11-02-2009 at 05:46 AM.. Reason: code tags, please... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|