Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
cut statment
Name: charles_cp Date: November 9, 2003 at 08:13:59 Pacific OS: AIX CPU/Ram: 900
Comment:
I have a text file like this: A Tom Wong B Mary Chan C Peter Wu D Steven Cheung
How to use the "cut" command to display the following: A Tom Wong B C Peter Wu D Steven Cheung
Name: Shaun Date: November 9, 2003 at 13:19:58 Pacific
Reply:
Not sure cut is what you want. That's usually used to extract text. You may want to loop through the file one line at a time and break eack line into fields, then process accordimgly. What would be the general purpose of your script?
0
Response Number 2
Name: Keith Date: November 11, 2003 at 17:32:48 Pacific
Reply:
'cut' is used to cut all fields, conditionals are better handled with awk, perl, sed, etc.
If you had some file "ick" that had the above, you could execute the following:
awk '!/Mary/ { print } /Mary/ {print $1}' ick2
I'd avoid looping at all cost as it is expensive. Like all things in UNIX, there are 50 ways to do it, 5 of which are optimum. Cheers,
Summary: Hi all, I am trying to cut the last field in myPath=/home/aby/asdf/newDir I want to sprune it to myDir=/home/aby/asdf and assign "temp=newDir" Wondering if cut can do it or is there a better way thru'...
Summary: Hello, This should be very easy for you gurus. I have this file with lots of data the fist column is time start with 0:0:0 and the second coulmn is color Red. and this repeat 300 times. so this is how...
Summary: Hi folks, I am been tasked to automate software builds, could some one kindly help with the following clarification regarding sed and cut cmds. i) can the sed be used more effectively? it does ...