49 && $2+$3+$4" />
![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Appending in a file | vinay123 | Shell Programming and Scripting | 1 | 06-19-2008 04:05 AM |
| Reading specific contents from a file and appending it to another file | dnicky | Shell Programming and Scripting | 5 | 10-04-2005 06:45 AM |
| printing to the screen | UNIX for Advanced & Expert Users | 2 | 10-24-2003 12:19 AM | |
| appending a file | chumba | UNIX for Dummies Questions & Answers | 1 | 05-24-2001 12:09 PM |
| Appending out to a file | Astudent | UNIX for Dummies Questions & Answers | 1 | 10-20-2000 03:17 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Appending to a file without printing to screen
Code:
#!/bin/csh
awk 'BEGIN { print "Name Exam1 Exam2 Exam 3 Total Grade" }' grades | tee gradesorted
awk '{if ($2+$3+$4<50){grade="F"}else if ($2+$3+$4>49 && $2+$3+$4<65)
{grade="D"}else if ($2+$3+$4>64 && $2+$3+$4<80){grade="C"}
else if ($2+$3+$4>79 && $2+$3+$4<90){grade="B"}else{grade="A"}}
{print $0, " ", $2+$3+$4, " ", grade;}' grades | tee gradesorted
What I'm trying to do change both the prints so that what's in the quotations gets appended to the file rather than printed to the screen. I've tried using sed with no success. Can anyone point me in the right direction? Thanks. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|