- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sed in ksh
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
04-20-2004 09:45 AM
04-20-2004 09:45 AM
I am using sed command to read from a XML file and write it out in another file the problem here is i have to read above and below the tags
some text exists otherwise exit
Thanks
STARTREL=`cat $FILE|sed -n '/
ENDREL=`cat $FILE|sed -n '/<\/Manifest>/='`
(( STARTREL = STARTREL - 1 ))
(( ENDREL = ENDREL + 1 ))
while
[ $STARTREL -le $ENDREL ]
do
RELNM=`cat $FILE|sed -n "$STARTREL,$STARTREL P"`
$RELNM >> $RELNOTES
do
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 10:52 AM
04-20-2004 10:52 AM
Re: Sed in ksh
How about this ?
sed '/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 11:17 AM
04-20-2004 11:17 AM
Re: Sed in ksh
With awk you can:
awk '/
{if (!flag) print ; flag=0} ' file_in > f_out
Frank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 02:25 PM
04-20-2004 02:25 PM
Re: Sed in ksh
Hi,
Maybe you still use "sed" but put a "\" before the "/".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 04:53 PM
04-20-2004 04:53 PM
Re: Sed in ksh
The best to use if there are such characters is ";",
i.e.
cat kapilraj |sed -e "s;BAD BOY;GOODBOY;g"
Regds,
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 08:32 PM
04-20-2004 08:32 PM
Re: Sed in ksh
STARTREL and ENDREL might both contain multiple entries. If not, you can replace the while with an if. You even should replace the test with something like:
[ "0$STARTREL" -le "0$ENDREL" ]
There are more problems in this script, btw. So I would recommend looking at the solutions given so far. perl and awk are languages that have this problem solved easily, for instance:
awk '/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2004 06:41 AM
04-21-2004 06:41 AM
Re: Sed in ksh
awk '/
it copies what is in between the tags i want to copy what in not between the tags
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2004 10:14 AM
04-21-2004 10:14 AM
Re: Sed in ksh
See my previus answer.
Frank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2004 02:19 AM
04-22-2004 02:19 AM
Re: Sed in ksh
I used
perl -ne 'print unless /^
format i want to print it in orignal format.
Thanks