Results 1 to 5 of 5
Using Bourne shell, is there an easy way to get the string in a specified field of output?
Something like this:
Code:
field 3 `ls -l $file`
to get the ...
- 02-17-2008 #1Just Joined!
- Join Date
- Jul 2006
- Posts
- 17
Bourne Scripting Question
Using Bourne shell, is there an easy way to get the string in a specified field of output?
Something like this:
to get the owner of $file.Code:field 3 `ls -l $file`
Or
to get only the checksum of $file.Code:field 1 `cksum $file`
Or is there a safer way of getting the owner, cksum, and size of a file?
Thanks.
- 02-17-2008 #2
Enter this at the shell prompt:
and all will be revealed.Code:man cut
If you do not have man pages installed on your system, google this:
Code:man cut linux
--
Bill
Old age and treachery will overcome youth and skill.
- 02-17-2008 #3Just Joined!
- Join Date
- Jul 2006
- Posts
- 17
Thank you!
- 02-18-2008 #4Linux User
- Join Date
- Aug 2006
- Posts
- 458
Code:# a=`cksum file` # set -- $a # echo $1 445709364
- 02-19-2008 #5Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
The most similar thing to this that you wrote above, under my point of view, would be to use awk.
I don't usually advice this though. And *nix has a command for this stuff anyway:Code:$ ls -l /etc/make.conf | awk '{ print $3 }' root
An interesting man page to read, by the way.Code:$ stat -c %U /etc/make.conf root


Reply With Quote
