|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 | Display Modes |
|
#1
|
|||
|
|||
|
Pattern search
Hi All , Please let me know how to get the below scenario done . Below is the file pattern which I have ... Code:
BEGIN DSSUBRECORD
Name "a"
Prompt "b"
Default "c"
ParamType "0"
ParamLength "0"
ParamScale "0"
END DSSUBRECORD
BEGIN DSSUBRECORD
Name "d"
Prompt "e"
Default "f"
ParamType "0"
ParamLength "0"
ParamScale "0"
END DSSUBRECORD
BEGIN DSSUBRECORD
Name "g"
Prompt "h"
Default "i"
ParamType "0"
ParamLength "0"
ParamScale "0"
END DSSUBRECORD
BEGIN DSSUBRECORD
Name "j"
Prompt "k"
Default "l"
ParamType "0"
ParamLength "0"
ParamScale "0"
END DSSUBRECORD
BEGIN DSSUBRECORD
Name "m"
Prompt "n"
Default "p"
ParamType "0"
ParamLength "0"
ParamScale "0"
END DSSUBRECORDI need to print the records starting from Name to ParamScale .Please note there are spaces in front of these lines . Expected output: Code:
Name "a"
Prompt "b"
Default "c"
ParamType "0"
ParamLength "0"
ParamScale "0"
Name "d"
Prompt "e"
Default "f"
ParamType "0"
ParamLength "0"
ParamScale "0"
Name "g"
Prompt "h"
Default "i"
ParamType "0"
ParamLength "0"
ParamScale "0"
Name "j"
Prompt "k"
Default "l"
ParamType "0"
ParamLength "0"
ParamScale "0"
Name "m"
Prompt "n"
Default "p"
ParamType "0"
ParamLength "0"
ParamScale "0"Please help ..... Last edited by Scrutinizer; 06-11-2012 at 01:40 PM.. Reason: code tags |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Try: Code:
grep -v DSSUBRECORD file |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Conversely: Code:
grep '"' file :-) |
|
#4
|
|||
|
|||
|
There are other contents also in the file . I had provided a part of the file ...
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Try: Code:
awk '$1=="Name",$1=="ParamScale"' infile |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
The above is not the full content of the file .. its a portion of the file ..
|
| Sponsored Links | |
|
|
#7
|
||||
|
||||
|
Did you try #5 ? What did you get and what did you expect?
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need one liner to search pattern and print everything expect 6 lines from where pattern match made | chidori | Shell Programming and Scripting | 8 | 03-15-2012 11:46 AM |
| Print a pattern between the xml tags based on a search pattern | oky | Shell Programming and Scripting | 13 | 03-21-2011 01:03 PM |
| search a pattern and if pattern found insert new pattern at the begining | pitagi | Shell Programming and Scripting | 7 | 02-12-2009 09:27 PM |
| modify a particular pattern starting from second line of the search pattern | imas | UNIX for Dummies Questions & Answers | 2 | 10-12-2008 11:30 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 02:41 PM |
|
|