- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed command explanation needed
Operating System - HP-UX
1822231
Members
3707
Online
109642
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
Discussions
Forums
Forums
Discussions
юдл
back
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
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
тАО09-26-2006 12:31 AM
тАО09-26-2006 12:31 AM
sed command explanation needed
Hi,
Could you please explain me the below statement -- phrase wise.
sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt
as early as possible.
Thanks,
Subbu
Could you please explain me the below statement -- phrase wise.
sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt
as early as possible.
Thanks,
Subbu
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 01:36 AM
тАО09-26-2006 01:36 AM
Re: sed command explanation needed
Hi, Subbu,
-e edit according to "operation" like 's/string1/strings2/'
:a label the edit operation as "a" and it will be used in branch option "b" so 'ba' means branch to "a".
The problem here is that whithout knowing what are $q, $cnt and $D it is impossible to tell exactly what this statement trying to do.
Regards,
Yang
-e edit according to "operation" like 's/string1/strings2/'
:a label the edit operation as "a" and it will be used in branch option "b" so 'ba' means branch to "a".
The problem here is that whithout knowing what are $q, $cnt and $D it is impossible to tell exactly what this statement trying to do.
Regards,
Yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 01:37 AM
тАО09-26-2006 01:37 AM
Re: sed command explanation needed
Hi Subbu,
This script is from sed one-liners:
http://www.student.northpark.edu/pemente/sed/sed1line.txt
It packs a lot of functionality into a very small program. Here's my best shot at parsing it:
sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt
-e <script> -- read from <script>
:a -- define label a
$q -- quit at EOF
N -- read in next line
'$cnt' -- $cnt-1 lines will be displayed
$D -- delete at EOF
ba -- branch to label a
abc.txt -- take abc.txt as input
> xyz.txt -- output to xyz.txt
For an easier-to-understand sed script that emulates 'tail', see "Sed - An Introduction":
http://www.grymoire.com/Unix/Sed.html#toc-uh-30
PCS
This script is from sed one-liners:
http://www.student.northpark.edu/pemente/sed/sed1line.txt
It packs a lot of functionality into a very small program. Here's my best shot at parsing it:
sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt
-e <script> -- read from <script>
:a -- define label a
$q -- quit at EOF
N -- read in next line
'$cnt' -- $cnt-1 lines will be displayed
$D -- delete at EOF
ba -- branch to label a
abc.txt -- take abc.txt as input
> xyz.txt -- output to xyz.txt
For an easier-to-understand sed script that emulates 'tail', see "Sed - An Introduction":
http://www.grymoire.com/Unix/Sed.html#toc-uh-30
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2006 03:21 AM
тАО09-26-2006 03:21 AM
Re: sed command explanation needed
Hi Yang & PCS,
Thank you very much guys for your quick response.
cheers,
Subbu.
Thank you very much guys for your quick response.
cheers,
Subbu.
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP