- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sed to delete a line with fixed start
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
07-27-2001 05:29 AM
07-27-2001 05:29 AM
Got a lot of xml files that I need to delete a line out of before my browser opens them.
The line always starts with
but the rest will always be different.
How can I use sed to do a delete or ' ' replacement of the entire line based on this.
Thanks guys!
Bill
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2001 05:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2001 05:38 AM
07-27-2001 05:38 AM
Re: sed to delete a line with fixed start
That last example works for being at the beginning of the line. If you want to delete the lines that contain anywhere on the line, just try it without the caret symbol:
sed '/
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2001 05:42 AM
07-27-2001 05:42 AM
Re: sed to delete a line with fixed start
I think this will work.
sed '/^ filename.out
mv filename.out filename
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2001 05:44 AM
07-27-2001 05:44 AM
Re: sed to delete a line with fixed start
how about "grep -v ..." ?
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2001 05:50 AM
07-27-2001 05:50 AM
Re: sed to delete a line with fixed start
it was just a simple cut and paste,
you saved me a lot of time... (I can go home
early now!)
Thanks,
have a good weekend.
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2001 04:26 AM
07-30-2001 04:26 AM
Re: sed to delete a line with fixed start
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2001 05:18 AM
07-30-2001 05:18 AM
Re: sed to delete a line with fixed start
I really don't know what is happening. I cut and paste your script and your file. Ran your script and everything worked fine as expected??????????
If adding a line to the end fixes your problem, then add it. Before the sed's in your script do:
echo "" >> $F
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2001 05:41 AM
07-30-2001 05:41 AM
Re: sed to delete a line with fixed start
after further analysis it appears to be only happening to files with encoding="UTF-8"
possibly related to the...
sed "s/$OLD/$NEW/g" $F > ${F}.tmp
I'll remove the rm just to verify and get back to you all.
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2001 08:14 AM
07-30-2001 08:14 AM
Re: sed to delete a line with fixed start
'sed' will drop the last "line" of a file if it has not been terminated by a newline char (I guess that it's not really a "line", then, is it :).
'grep -v', as was suggested, doesn't suffer from this malady, however.