![]() |
|
|
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 |
| Append each line to next previous line in a file | sudhakaryadav | Shell Programming and Scripting | 8 | 06-01-2009 12:21 PM |
| Append line that does not contain pipe to it previous line | ainuddin | Shell Programming and Scripting | 11 | 11-11-2008 10:58 AM |
| Joining lines in reverse. append line 1 to line 2. | dwalley | Shell Programming and Scripting | 7 | 08-04-2008 08:11 AM |
| How to append some strings line by line? | xinoo | Shell Programming and Scripting | 4 | 06-24-2008 03:04 AM |
| append a line to the last line in a file | subhrap.das | UNIX Desktop for Dummies Questions & Answers | 5 | 04-25-2007 10:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
append last line
Suppose i have a file FILE1.TXT Code:
2293847982374 sdj 23423 2298372038974 dsj 23492 2972837629376 abj 34929 2984836398384 abc 39723 I want to append the above FILE1.TXT with total no of records and appending to the last line with "3000004" total 7 digits only, if 12 records then "3000012" to bottom of the line, in this case below Code:
2293847982374 sdj 23423 2298372038974 dsj 23492 2972837629376 abj 34929 2984836398384 abc 39723 3000004 regards Last edited by vgersh99; 10-27-2009 at 01:06 PM.. Reason: fixed code tags |
|
||||
|
the no of records is not always the same. In the Input file there may be some more than 100 records we dont no... BTW the above code has syntax error Code:
>awk 'END{print $0,"\n""3000004"}1' file1.txt
awk: syntax error near line 1
awk: bailing out near line 1
Last edited by pludi; 10-27-2009 at 01:04 PM.. Reason: code tags please... |
| Bits Awarded / Charged to kshuser for this Post | |||
| Date | User | Comment | Amount |
| 10-27-2009 | pludi | code tags added - 3K charge | -3,000 |
|
||||
|
i am getting syntax error as i want this in KSH script Code:
>awk 'NF{c++;print} END{print (3000000 + c)}' ein_data_file.txt > ein_data_file1.dat
awk: syntax error near line 1
awk: bailing out near line 1
Last edited by vgersh99; 10-27-2009 at 02:38 PM.. Reason: fixed code tag |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|