![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract x lines after a pattern - place each result in separate file | gobi | Shell Programming and Scripting | 5 | 06-06-2008 12:03 PM |
| extract field of characters after a specific pattern - using UNIX shell script | jansat | HP-UX | 2 | 05-27-2008 09:08 PM |
| nawk-how count the number of occurances of a pattern, when don't know the pattern | cyber111 | Shell Programming and Scripting | 2 | 05-11-2008 12:00 AM |
| Breaking output for specific pattern | shoeb_syed | UNIX for Dummies Questions & Answers | 2 | 03-08-2006 01:00 AM |
| Finding a specific pattern from thousands of files ???? | aarora_98 | Shell Programming and Scripting | 6 | 02-17-2006 05:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
Vino,
i think I was wrong in quoting my question. Actually I want the pattern between the pair "OBJECT" and "FILEDS"(excluding the line "FIELDS") Quote:
I found following awk command working as per my requirements. How can I remove the use of grep here. $awk '/OBJECT *TYPE/,/FIELDS/' test.dat|grep -v FIELDS |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
Quote:
Code:
[/tmp]$ cat txt OBJECT TYPE="locale", NAME=locale_nl_NL, UNIQUE_FIELD=win32_lcid FIELDS clarify_lang = 0; END_FIELDS END_OBJECT NAME=locale_nl_NL OBJECT TYPE="locale", NAME=locale_nl_BE UNIQUE_FIELD=win32_lcid FIELDS iso_cntry = "BE"; END_FIELDS END_OBJECT NAME=locale_nl_BE [/tmp]$ sed -n -e "/OBJECT TYPE/p" -e "/UNIQUE_FIELD/p" txt OBJECT TYPE="locale", NAME=locale_nl_NL, UNIQUE_FIELD=win32_lcid OBJECT TYPE="locale", NAME=locale_nl_BE UNIQUE_FIELD=win32_lcid [/tmp]$ |
|
#10
|
|||
|
|||
|
Vino ,
your command is printing the lines containg "OBJECT TYPE" and "UNIQE_FIELD". I want the o/p between the pairs "OBJECT TYPE" and "FIELDS". Quote:
|
|
#11
|
||||
|
||||
|
This is what you posted.
Quote:
Code:
sed -n -e "/OBJECT TYPE/p" -e "/UNIQUE_FIELD/p" txt Code:
OBJECT TYPE="locale", NAME=locale_nl_NL, UNIQUE_FIELD=win32_lcid OBJECT TYPE="locale", NAME=locale_nl_BE UNIQUE_FIELD=win32_lcid |
|
#12
|
||||
|
||||
|
I am sorry if I was misleading you.
My question is same right from my first post. Say my input file is Quote:
Quote:
Quote:
Quote:
|
||||
| Google The UNIX and Linux Forums |