Computing.Net > Forums > Unix > sed/awk word search

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

sed/awk word search

Reply to Message Icon

Name: foxyscootie
Date: February 19, 2004 at 13:21:48 Pacific
OS: Solaris 8/UNIX
CPU/Ram: Ultra 10
Comment:

Is there a way to search for a word using sed or awk? I need to read from file2 into file1, but only between two specific sections in file1. I can't use perl because the rest of my file is written using bash scripting.
I am new to scripting & would appreciate the help. Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: aigles
Date: February 19, 2004 at 14:48:57 Pacific
Reply:

To select lines from 'word1' to 'word2' :

sed -n '/word1/,/word2/p' file2 < file 1

awk '/word1/,/word2/' file2 > file1

Jean-Pierre.


0
Reply to Message Icon

Related Posts

See More


Read win file from Unix p... what does this redirectio...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: sed/awk word search

sed/awk - line feeds? www.computing.net/answers/unix/sedawk-line-feeds/5237.html

sed/awk search and replace www.computing.net/answers/unix/sedawk-search-and-replace-/7872.html

sed & awk question www.computing.net/answers/unix/sed-amp-awk-question/4136.html