- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: File manipulation help
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
Discussions
Discussions
Forums
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
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
тАО12-18-2003 04:33 AM
тАО12-18-2003 04:33 AM
File manipulation help
Newsgroups: xxx
From: xxx
Subject: xxx
Date: xxx
Path: linux-nntp!forums-master!forums-1-dub!forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: linux-nntp sybase.test.xml:99
zzzzzzzzzzzzzzzzzzzzz
1)I need to replace "linux-nntp" in the line starting XRef: to "test".
2)I need to extract the number after sybase.text.xml from the line starting XRef: to a variable
3)Also I need to delete the text "linux-nntp!forums-master!" from the line starting "Path:"
Can soem one provide scripts for doing these operations.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 05:29 AM
тАО12-18-2003 05:29 AM
Re: File manipulation help
nbr=`sed -n -e '/^XRef/s/linux-nttp/test/' -e '/^Path: linux/d' -e 'w yournewfile' -e '/^XRef/s/^.*://p'`
By using "w" command under sed, you can copy the lines to "yournewfile" making the changes. The -n option tells sed not to automatically print each line. The only "p" command above is used to print the number you want off the "Xref" line.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 11:50 AM
тАО12-18-2003 11:50 AM
Re: File manipulation help
I have following line in the file:
Xref: linux-nntp sybase.test.xml:99
I need to extract the number 99 into a variable. I will be using this number to create a new file with that name. Please help....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 11:54 AM
тАО12-18-2003 11:54 AM
Re: File manipulation help
#! rnews 0
Newsgroups: xxx
From: xxx
Subject: xxx
Date: xxx
Path: linux-nntp!forums-master!forums-1-dub!forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: linux-nntp sybase.test.xml:99
zzzzzzzzzzzzzzzzzzzzz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 07:32 PM
тАО12-18-2003 07:32 PM
Re: File manipulation help
you dont need the number. Just run the sed commands or whatever comes up here, which is fine for you and then run the script of Jim from the other thread, you posted, to split the file.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 08:00 PM
тАО12-18-2003 08:00 PM
Re: File manipulation help
outfile='default.output'
rnews 0 | while read line
do
part1=$(echo $line | cut -d: -f1)
case $part1 in
Xref)
line=$(echo $line | sed 's|linux-nntp|test|')
outfile=$(echo $line | awk FS=: '{print $NF}')
;;
Path)
line=$(echo $line | sed 's|linux-nntp!forums-master!||'
;;
*)
;;
esac
echo $line >> $outfile
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 10:12 PM
тАО12-18-2003 10:12 PM
Re: File manipulation help
no offense, but your approach is flawed. It writes all lines including rnews until the first xref into default.output. After that it divides the news at the wrong place into wrong files. You will have to make a major design change to get it work. I think, the csplit in his other thread is a great idea and combined with a few sed commands should work nicely.
greetings,
Michael