- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Simple question for sed/awk/perl experts
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
12-18-2002 03:15 AM
12-18-2002 03:15 AM
I am not a very good script programmer :(
Please help!
The following file should be modified:
...
/backup01/pfs/sy/frm/sy001oc0.fmb
/backup01/pfs/sy/frm/rf910oc0.fmb
/backup01/pfs/sy/frm/rf920oc0.fmb
/backup01/pfs/sy/frm/rf930oc0.fmb
/backup01/pfs/sy/frm/rf940oc0.fmb
/backup01/pfs/sy/frm/rf950oc0.fmb
/backup01/pfs/sy/frm/rf001oc0.fmb
/backup01/pfs/sy/frm/rf810oc0.fmb
...
to become:
...
f60gen /backup01/pfs/sy/frm/sy001oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf910oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf920oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf930oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf940oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf950oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf001oc0.fmb ops\$yd/yd@pfs Compile_All=YES
f60gen /backup01/pfs/sy/frm/rf810oc0.fmb ops\$yd/yd@pfs Compile_All=YES
...
I have tried "sed" in my script:
cat myfile.log | sed s/\/backup01/f60gen \/backup01 > f1.log
cat f1.log | sed s/.fmb/.fmb ops\$yd/yd@pfs Compile_All=YES > myfile.log
and am getting the following error:
sed: Function s//backup01/f60gen cannot be parsed.
sed: Function s/.fmb/.fmb cannot be parsed.
Thanks a lot for a solution or any simple alternatives.
Best Regards
Yogeeraj
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:20 AM
12-18-2002 03:20 AM
Re: Simple question for sed/awk/perl experts
not tested
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:21 AM
12-18-2002 03:21 AM
Re: Simple question for sed/awk/perl experts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:27 AM
12-18-2002 03:27 AM
Re: Simple question for sed/awk/perl experts
You're very close - you just need a trailing / in your sed command:
cat myfile.log | sed s/\/backup01/f60gen \/backup01/ > f1.log
(the trailing / is between "backup01" and "> f1.log"
Same thing in the second case.
I think that should do it.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:29 AM
12-18-2002 03:29 AM
Re: Simple question for sed/awk/perl experts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:31 AM
12-18-2002 03:31 AM
Re: Simple question for sed/awk/perl experts
Chris: Wonderful it works! Thanks.
procura: or should i call you "perl" master? ;) Thanks a lot. Although i gave a hard task of "add missing trailing quote".
It was as if i was asking you a tip on the phone :)
Problem solved. period.
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:41 AM
12-18-2002 03:41 AM
Re: Simple question for sed/awk/perl experts
pete:
Encouraging reply. however does not work :(.
still giving me error:
sed: Function s//backup01/f60gen cannot be parsed.
Procura:
I am a bit lost! where do i specify my file as argument?
Thanks a lot
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:45 AM
12-18-2002 03:45 AM
Re: Simple question for sed/awk/perl experts
sed Version
sed -e 's/\/backup01/f60gen \/backup01/' -e 's/fmb/fmb ops$yd\/yd@pfs Compile_All=YES/' infile
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:53 AM
12-18-2002 03:53 AM
Re: Simple question for sed/awk/perl experts
or
# perl -ple 's{(.*)}{f60gen $1 ops\\$yd/yd\@pfs Compile_All=YES} ' < filename
or
# script_to_generate_list |
# perl -ple 's{(.*)}{f60gen $1 ops\\$yd/yd\@pfs Compile_All=YES} '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 03:55 AM
12-18-2002 03:55 AM
Re: Simple question for sed/awk/perl experts
that was great!
Everything is working fine here!
Cheers
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 04:23 AM
12-18-2002 04:23 AM
Re: Simple question for sed/awk/perl experts
with all your helps, my fully working script now looks as follows:
============================================================
#!/bin/sh
DIR=/backup01/pfs
find ${DIR} -xdev -type f -name '*.fmb'|sed -e 's/\/backup01/f60gen \/backup01/' -e 's/fmb/fmb ops$yd\/yd@pfs Compile_All=YES/' > compile_all.sh
find ${DIR} -xdev -type f -name '*.mmb'|sed -e 's/\/backup01/f60gen \/backup01/' -e 's/mmb/mmb ops$yd\/yd@pfs Compile_All=YES module_type=menu/' >> compile_all.sh
find ${DIR} -xdev -type f -name '*.pll'|sed -e 's/\/backup01/f60gen \/backup01/' -e 's/pll/pll ops$yd\/yd@pfs Compile_All=YES module_type=library/' >> compile_all.sh
#end-YD
============================================================
thank you forum!
Cheers
Yogeeraj