![]() |
|
|
|
|
|||||||
| 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 |
| How to find a count of a word within a file | bd_joy | Shell Programming and Scripting | 9 | 07-14-2008 06:29 AM |
| how to move word by word on command line | pbsrinivas | UNIX for Dummies Questions & Answers | 1 | 11-23-2007 03:17 AM |
| Change Position of word character | cedrichiu | Shell Programming and Scripting | 6 | 03-11-2007 10:52 PM |
| how to find a word repeated in a file | gurukottur | UNIX for Dummies Questions & Answers | 4 | 08-24-2006 01:53 AM |
| Can a shell script pull the first word (or nth word) off each line of a text file? | tricky | Shell Programming and Scripting | 5 | 08-17-2006 03:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I have a file with lines written somewhat like this. Code:
aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec dsdc cdc wd wdcew dwed market browse = yes dwdw wedwe we and then change the line from browse = no to browse = yes which is after two lines from the word police. Pls help... I am not so advanced in scripting. Thanks in advance, Vikas |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
Code:
awk '/^police$/ { browse=1; } browse==1 && /^browse/ { print "browse = yes"; browse=0; next; } 1' <infile >outfile
|
|
#3
|
|||
|
|||
|
Quote:
thanks a lot, will try this code & revert. |
|||
| Google The UNIX and Linux Forums |