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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

sed/awk word search

Reply to Message Icon

Original Message
Name: foxyscootie
Date: February 19, 2004 at 13:21:48 Pacific
Subject: sed/awk word search
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!


Report Offensive Message For Removal


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

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

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

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

Jean-Pierre.


Report Offensive Follow Up For Removal







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








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software