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.
Korn shell cut question
Name: eversmiler Date: January 12, 2006 at 13:03:03 Pacific OS: 2000 CPU/Ram: Intel P4 512
Comment:
I use the following command on the command line: print test.one.two | cut -d\. f1 and the output is test when i use the same command in my shell script: filename=test.one.two | cut -d\. f1 print $filename it does not print anything would someone please help me undestand thank you
Name: vicchai Date: January 13, 2006 at 06:12:08 Pacific
Reply:
Try this:
filename=`print test.one.two | cut -d\. f1`
0
Response Number 2
Name: eversmiler Date: January 13, 2006 at 12:01:04 Pacific
Reply:
Thank you for the response. I tried the command, but the output I got is: print test.one.two|cut -d\. -f1
whereas the output I was expecting is: test
Ever Smiler
0
Response Number 3
Name: ghostdog Date: January 13, 2006 at 18:20:46 Pacific
Reply:
hi did you do an
echo $filename ?
0
Response Number 4
Name: eversmiler Date: January 16, 2006 at 12:04:49 Pacific
Reply:
ghostdog
Yes, I did! As a matter of fact, I tried both: echo $filename and print $filename and received the same output as outlined above.
Any more help would be appreciated.
Ever Smiler
0
Response Number 5
Name: David Perry Date: January 17, 2006 at 05:58:35 Pacific
Reply:
Those marks are backticks ( look below the tilde character ) not single quotes.
0
Response Number 6
Name: eversmiler Date: January 18, 2006 at 07:05:02 Pacific
Reply:
Woo Hoo! That worked! Thank you all for your help. Vicchai did have it in his response, but it took Perry's to point out the ticks to me. Thank you again you nice people for taking the time.
Summary: hi, I have a question. I'm doing a Korn Shell script. I want to find out the list of users who have either logged in or logged out during the period(like 20 minutes or etc). Thank you for helping.(...
Summary: Hi: Since you're data is fixed length, you can do something like this: while read x do f1=$(echo $x|cut -c1-4) f2=$(echo $x|cut -c5-6) f3=$(echo $x|cut -c7-8) f4=$(echo $x|cut -c9-10) f...
Summary: I know that grep the_specified_string myfile can finds a line that contains a specified string in a file. How can I reach the same goal in a korn shell script? Thanks a lot for your help! Mei ...