- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Shell scripting issue
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
тАО08-25-2005 06:48 PM
тАО08-25-2005 06:48 PM
I have an issue on a shell scripting. I have a regular file called fileA below :
##### BEGIN M400#4 #####
/var/opt/secu/log/console
/var/spool/sockets/pwgr
/var/opt/dce/rpc/local/s-0
/var/opt/dce/rpc/local/s-3
/var/spool/cron/tmp
##### END M400#4 #####
How can I trigger the file using a shell script, so the result will be all lines between "BEGIN M400#4" and "END M400#4".
So the result should be :
/var/opt/secu/log/console
/var/spool/sockets/pwgr
/var/opt/dce/rpc/local/s-0
/var/opt/dce/rpc/local/s-3
/var/spool/cron/tmp
Pls help. High score will be given.
Thanks for your help in advance.
Best Regards,
Dewa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:03 PM
тАО08-25-2005 07:03 PM
Re: Shell scripting issue
sed -e '/BEGIN M400#4,/END M400#4/p'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:03 PM
тАО08-25-2005 07:03 PM
Re: Shell scripting issue
There is several ways to do this,
cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:12 PM
тАО08-25-2005 07:12 PM
Re: Shell scripting issue
Hi Vibhor,
I got an error message when run your script :
[root@sihp8039:/home/ap1030]
# sed -e '/BEGIN M400#4,/END M400#4/p'
sed: /BEGIN M400#4,/END M400#4/p is not a recognized function.
Hi Leif,
How can we state on the script with "BEGIN M400#4" and "END M400#4"? How the command will be?
Best Regards,
Dewa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:15 PM
тАО08-25-2005 07:15 PM
Re: Shell scripting issue
I got this error when I run as your advise.
[root@sihp8039:/home/ap1030]
# sed -e '/BEGIN M400#4/END M400#4/p' fileA
sed: /BEGIN M400#4/END M400#4/p is not a recognized function.
Thanks.
Dewa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:59 PM
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 11:47 PM
тАО08-25-2005 11:47 PM
Re: Shell scripting issue
another simple way:
grep -v "^###" fileA
Rgds,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2005 12:14 AM
тАО08-26-2005 12:14 AM
Re: Shell scripting issue
or
egrep -v 'BEGIN M400|END M400'
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2005 01:19 AM
тАО08-26-2005 01:19 AM
Re: Shell scripting issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2005 03:20 PM
тАО08-26-2005 03:20 PM
Re: Shell scripting issue
I got the answer.
Thank you very much for your help.
Have a nice day.
Best Regards,
Dewa