Help with cut statement

Hi i have the below content in a file and i am trying to cut 5.4 , but when i use the below cut command nothing comes up . I am not sure what i am doing wrong. I am new to unix. Please help me, thanks for the help in advance.

$ cat pid.txt
 5.4 21399 ./PreRating

$ cut -d ' ' -f1 pid.txt

$

OS Used: Linux

What is the file type?

$ file pid.txt

hi pawan,
its in ASCII

$ file pid.txt
pid.txt: ASCII text

the cut command is working for me as it is

cut -d ' ' -f1 abc.txt

try using awk

awk '{print $1}' abc.txt

Strange,:slight_smile:

When i replicate I got the desired result.

 
-sh-3.00$ cat pid.txt
5.4 21399 ./PreRating
-sh-3.00$ cut -d ' ' -f1  pid.txt
5.4
-sh-3.00$ file pid.txt
pid.txt: ASCII text
 
-sh-3.00$ env
TERM=xterm
SHELL=/bin/sh

I am checking for other possibilities...

---------- Post updated at 08:14 AM ---------- Previous update was at 08:07 AM ----------

what is the output for below command.

 
$ cut -d ' ' -f1-2 pid.txt
cut -d ' ' -f1-2 pid.txt
 5.4

Its seems pid.txt file starting with "space", that it the reason when you are trying with -f1 you are getting empty space,

you should try this below code.(insted of field 1, you should cut field 2)

$cut -d ' ' -f2  pid.txt

Thanks pawan. :slight_smile:

yw :slight_smile: