Cut command - problems
3 posters
Cut command - problems
I have a file abc with contents :
125
2:pqr:30
3:rst:12
Now, suppose I give cut -d : -f 1 abc -> we get
1
2
3
But, if we have multiple fields in the above command the delimiter is still present.Isn't cut supposed to strip by delimiter ? Will the delimiter between column 1 and 2 be present in the output as well ?
125
2:pqr:30
3:rst:12
Now, suppose I give cut -d : -f 1 abc -> we get
1
2
3
But, if we have multiple fields in the above command the delimiter is still present.Isn't cut supposed to strip by delimiter ? Will the delimiter between column 1 and 2 be present in the output as well ?
Maithreyi- Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia
pls be still clear
i just cant understand your question completely.
are you asking that why does the command
produces output like
or some things else???
are you asking that why does the command
- Code:
cut -d : -f1,2 abc
produces output like
- Code:
1:abc
2:pqr
3:rst
or some things else???
Re: Cut command - problems
@mightyganesh that was what I was asking!
@Christopher Thanks!
@Christopher Thanks!
Maithreyi- Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia
Re: Cut command - problems
good! it will contain : in the output
do u wanna know how to remove that delimiter from the output ??
then try
this will remove the delimiter produced by the code
do u wanna know how to remove that delimiter from the output ??
then try
- Code:
cat /etc/passwd | cut -d ':' -f1,2,3 | tr ':' '\0'
this will remove the delimiter produced by the code
- Code:
cat /etc/passwd | cut -d ':' -f1,2,3
Similar topics
» tee command doubt
» CDUP COMMAND
» What s d diff between 'sed' and 'tr' command??
» how to use a variable in sed command
» unix command!!!!
» CDUP COMMAND
» What s d diff between 'sed' and 'tr' command??
» how to use a variable in sed command
» unix command!!!!
Permissions in this forum:
You cannot reply to topics in this forum
|
|