- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed delete lines from `cat somefile`
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2002 12:10 PM
03-14-2002 12:10 PM
sed delete lines from `cat somefile`
here is the problem....
for i in `cat /tmp/sometxtfile`
do
sed '/$i/d' inputfile > outfile
done
I do not get my inputfile cleaned up with the content of sometxtfile
How would you do it???
TIA
Francis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2002 12:32 PM
03-14-2002 12:32 PM
Re: sed delete lines from `cat somefile`
You are doing the sed once and writing to outputfile, but the next time, next value of $i, you are still useing the original inputfile and overwriting outputfile.
I think somewhere you need to move mv outputfile to inputfile or use variables for them.
something like:
INPUT=inputfile
OUTPUT=outputfile
for i in `cat /tmp/sometxtfile`
do
sed -e /$i/d $INPUT > $OUTPUT
mv $OUTPUT $OUTPUT.1
INPUT=$OUTPUT.1
OUTPUT=outputfile
done
Once this is done, have a look at outputfile.1 and I think you will be pleased with the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2002 12:45 PM
03-14-2002 12:45 PM
Re: sed delete lines from `cat somefile`
Happy camper :-))
Thanx again
Francis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2002 12:47 PM
03-14-2002 12:47 PM
Re: sed delete lines from `cat somefile`
I'll try l8r
Francis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2002 01:55 PM
03-14-2002 01:55 PM
Re: sed delete lines from `cat somefile`
cat /tmp/sometxtfile | sed 's/^(.*)$/\/\1\/d/' >/tmp/file2
sed -f /tmp/file2
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2002 05:45 AM
03-15-2002 05:45 AM