The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-23-2008
mirusnet's Avatar
Registered User
 

Join Date: Dec 2007
Posts: 139
Sed question

echo "SOME" | sed -e :a -e "s/^.\{1,$COUNT\}$/ &/;ta"


Could someone please,
tell me how does this script work?
Also, what is ":a" and what for what it's needed?
Reply With Quote
Forum Sponsor
  #2  
Old 01-23-2008
Registered User
 

Join Date: Jun 2006
Posts: 74
Is this command part of a script? If yes, could you post the entire script else what is $COUNT?

:a - defines a label 'a' and
ta - branches to (like goto) to label 'a' if the substitution is successful

I understand that this sed is trying to right justify the text to $count characters(provided the line length is less than $count character).


Quote:
Originally Posted by mirusnet View Post
echo "SOME" | sed -e :a -e "s/^.\{1,$COUNT\}$/ &/;ta"


Could someone please,
tell me how does this script work?
Also, what is ":a" and what for what it's needed?

Last edited by quintet; 01-23-2008 at 07:52 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0