How to do this


I have a file like this

001 name_01
002 name_02
003 name_03

The output that I need from this file above is :

001  002  003

How do this in a shell command ? I prefer it to do it with sed or awk.
Thanks for help
jvras
jvrasAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ecwConnect With a Mentor Commented:
 echo `cut -d' ' -f1 file`
or
  awk '{printf("%s" $1)}END{print}' file
0
 
yuzhCommented:
Here is what you need to do:

assume that your file name is: test.txt

type in:

cat test.txt | awk '{print $1} | tr "\012" " " > test.tmp
echo "" >> test.tmp
mv test.tmp test.txt

This should work for you.

0
 
jvrasAuthor Commented:

ecw is giving me the just answer.
Thanks
jvras
0
All Courses

From novice to tech pro — start learning today.