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.
another awk question
Name: narsman Date: January 28, 2005 at 11:46:18 Pacific OS: Windows NT CPU/Ram: 2.0Ghz 512mb RAM
Comment:
Suppose you have this table:
/home% cat file1 6 fish salmon 1abc1 4 bird parrot 1abc2 9 dog boxer 1abc3 5 insect ant 1abc4
What I need to do is to replace all field 4 with the word "pet" then a dash (-) the the number that appears on field 1. The output should be:
6 fish salmon pet-6 4 bird parrot pet-4 9 dog boxer pet-9 5 insect ant pet-5
Summary: Here's what goes on in the script... The results of grep are assigned to grp1 and grp2. $grp1 is 1file08[1] 1file04[2] 1file05[3] 1file09[4] $grp2 is 2file08[1] 2file05[2] 2file09[3] I put them in a ...
Summary: Thank you for your response on my previous question on "Reformatting the month of year"! I have another question regarding passing a variable to awk command. I have a file with file lablels in it, fo...
Summary: A question for ya. Using sed or awk or both. Below is an example of a file. These are accounts. From the record PT to the next PT is one account. I want to strip off the carriage return & line fe...