GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- File manipulation Help ??
Operating System - HP-UX
1848483
Members
7342
Online
104029
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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:59 AM
12-18-2003 04:59 AM
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
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
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
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 05:10 AM
12-18-2003 05:10 AM
Re: File manipulation Help ??
If you are willing to use perl, here is the code. This will definitely require tweaking, but I just put something simple down so you see what I'm doing. Let me know if you have any questions:
open (FILE,);
while() {
($garbage, $replace) = split(/:/);
if ($replace =~ "linux-nntp")
{
$replace =~ s/linux-nntp/test/;
($garbage2, $number) = split(/:/);
$var = $number;
}
($filename, $to_address) = split(/:/);
if ($replace =~ "linux-nntp!forums-master!")
{
$replace =~ s/linux-nntp!forums-master!//;
}
-Hazem
open (FILE,
while(
($garbage, $replace) = split(/:/);
if ($replace =~ "linux-nntp")
{
$replace =~ s/linux-nntp/test/;
($garbage2, $number) = split(/:/);
$var = $number;
}
($filename, $to_address) = split(/:/);
if ($replace =~ "linux-nntp!forums-master!")
{
$replace =~ s/linux-nntp!forums-master!//;
}
-Hazem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 05:12 AM
12-18-2003 05:12 AM
Re: File manipulation Help ??
Oops, take out the last
($filename, $to_address) = split(/:/);
before the last if statement.
-Hazem
($filename, $to_address) = split(/:/);
before the last if statement.
-Hazem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 05:14 AM
12-18-2003 05:14 AM
Re: File manipulation Help ??
Not sure what you want to do with the number
You may adapt from this script :
#!/bin/sh
awk '
{
if(substr($0,1,4)=="Xref") {
sub("linux-nntp","test");
split($0,tab,":");
num=tab[3];
}
if(substr($0,1,4)=="Path") {
sub("linux-nntp!forums-master!" ,"")
}
print $0;
}
END{print "NUMBER is",num;} ' $1
$1 is the file you want to process.
Regards,
Jean-Luc
You may adapt from this script :
#!/bin/sh
awk '
{
if(substr($0,1,4)=="Xref") {
sub("linux-nntp","test");
split($0,tab,":");
num=tab[3];
}
if(substr($0,1,4)=="Path") {
sub("linux-nntp!forums-master!" ,"")
}
print $0;
}
END{print "NUMBER is",num;} ' $1
$1 is the file you want to process.
Regards,
Jean-Luc
fiat lux
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP