![]() |
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 |
| insert multiple lines into a file | c0mrade | Shell Programming and Scripting | 12 | 09-04-2008 04:04 PM |
| Adding Multiple Lines to Multiple Files | dayinthelife | Shell Programming and Scripting | 2 | 06-04-2008 11:50 AM |
| How to copy multiple lines from a file to another using AWK? | jisha | Shell Programming and Scripting | 3 | 01-08-2008 01:04 AM |
| Need to delete multiple lines in a file. | kangdom | Shell Programming and Scripting | 6 | 10-16-2006 11:02 AM |
| Add Multiple Lines in an existing file | hkhan12 | Shell Programming and Scripting | 5 | 09-08-2006 11:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
retrieved multiple lines on multiple places in a file
I have a file containing the following lines:
first line second line third line something goes here something else goes here something goes here first line1 second line2 third line3 I need to go through the file and retrieved these lines and print them the output should look like this: first line second line third line first line1 second line2 third line3 Please help me get start it. I used while loop but the output wasn’t what I want it. |
|
||||
|
Thx otheus, to answer your question, I am using `grep "^first"`, when I found it I would continue and grep for the "^second" word and so on.
|
|
|||||
|
Quote:
Code:
case "$line" in Code:
case "${line%% *}" in
first|second|third) echo "$line";;
esac
|
|
||||
|
Quote:
Code:
while read -r a b do case $a in .... esac done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|