Thursday, October 27, 2011

Linux cut sed examples

Linux cut and sed examples:

cut -d" " -f3 
example:
echo this is cut example |cut -d" " -f3
cut


sed 's/\.$//' # cut the last . from the line
example:
echo this is sed example. | sed 's/\.$//'
this is sed example






Mix:  |cut -d" " -f3 |sed 's/\.$//'
echo this is mixexample. | cut -d" " -f3 |sed 's/\.$//'
mixexample


Ref: http://www.ibm.com/developerworks/linux/library/l-sed3/index.html
http://www.grymoire.com/Unix/Sed.html

1 comment: