doubt in tr
4 posters
doubt in tr
$ cat /etc/shells | sed 's/bash/BASH/g' | tr '[a-z]' '[A-Z]'
also i have a doubt to use head using sed...and wc -l using sed
thnx in advance.:-)
also i have a doubt to use head using sed...and wc -l using sed
thnx in advance.:-)
soumya22- Posts : 4
Points : 6
Join date : 2010-03-03
Re: doubt in tr
in above stmt, sed will replace all 'bash' to 'BASH' and tr converts all lowercase to uppercase.
I think this is not ur question. can u be little clear???
I think this is not ur question. can u be little clear???
Re: doubt in tr
actually it is showing error
tr: missing operand after `[a-z][A-Z]'
Two strings must be given when translating.
Try `tr --help' for more information.
tr: missing operand after `[a-z][A-Z]'
Two strings must be given when translating.
Try `tr --help' for more information.
soumya22- Posts : 4
Points : 6
Join date : 2010-03-03
Re: doubt in tr
k....we solved it...
but how to use 'head' in sed 'wc -l' in sed
but how to use 'head' in sed 'wc -l' in sed
soumya22- Posts : 4
Points : 6
Join date : 2010-03-03
Re: doubt in tr
check the quotes.
it should be tr '[a-z]' '[A-Z]'. I guess u typed as tr '[a-z] [A-Z]'
it should be tr '[a-z]' '[A-Z]'. I guess u typed as tr '[a-z] [A-Z]'
Re: doubt in tr
i dont think the question is using head in sed.. its showing the fnality of head in sed..
Saradha Kannan- Posts : 25
Points : 25
Join date : 2010-03-04
Re: doubt in tr
$ sed 2q /etc/shells
/bin/sh
/bin/bash
This is same as head -2 /etc/shells
/bin/sh
/bin/bash
This is same as head -2 /etc/shells
Saradha Kannan- Posts : 25
Points : 25
Join date : 2010-03-04
Re: doubt in tr
head:
sed '10q' aaa.txt
==>first ten lines ll be printed...
wc :
sed -n '$=' aaa.txt
===> willl print t count of lines
sed '10q' aaa.txt
==>first ten lines ll be printed...
wc :
sed -n '$=' aaa.txt
===> willl print t count of lines
anand- Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36
Re: doubt in tr
further reference for "sed " command check out "unix cmd doubt " topic in this forum....
anand- Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36
Re: doubt in tr
To count number of characters in first 3 lines of the file.
- Code:
$ sed '3q' <filename> | wc -c
Last edited by Christopher on Fri Mar 05, 2010 4:58 pm; edited 1 time in total
Permissions in this forum:
You cannot reply to topics in this forum
|
|