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.
Unix scripting
Name: wrwe Date: November 3, 2008 at 08:34:08 Pacific OS: xp CPU/Ram: core 2 dual 2gb
Comment:
Hello, i'm new with the scripting on unix and i need such script or maby something to that way:
I need to change the the first word in every new line to a given word. Using just /bin/sh ( not using sed, awk, perl and ect).
Name: nails Date: November 3, 2008 at 10:15:25 Pacific
Reply:
I won't do all of your homework, but I'll do the hard part. Assuming a field separator of white space, this reads the first word and the restofthe line:
#/bin/sh
while read firstword restofline do echo $firstword firstword="whatever" done < datafile.txt
# All you have to do is glue firstword and restofline back together.
0
Response Number 2
Name: wrwe Date: November 9, 2008 at 11:39:02 Pacific
Reply:
thanks for reply, i have it done. But now i'am interested to write it usig awk and sed. Maby somebody could help me with that?
0
Response Number 3
Name: nails Date: November 10, 2008 at 10:36:02 Pacific
Reply:
# for awk, look at section 3.4 changing the contents of a field:
Summary: I'm getting a little frustrated and would appreciate any help. I'm writting a unix script, and no matter what I do, it ignores the command line variables. At this point, I'm just trying to echo out wh...
Summary: Hi, I am trying to write a unix script for a student database program. I have some pieces of script for this database that was left to me. The main menu has options that brings their own me...