|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Awk not working due to missing new line character at last line of file
Hi, My awk program is failing. I figured out using command Code:
od -c filename that the last line of the file doesnt end with a new line character. Mine is an automated process because of this data is missing. How do i handle this? I want to append new line character at the end of last line in file if it is missing. i tried doing this. Code:
echo ,,,, >> file thinking this will add a line the file. Quote:
I want Quote:
Help is appreciated |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Code:
echo "" >> filename Will add a new line character to the end of the file. Code:
$ echo fred > fred
$ od -bc fred
0000000 146 162 145 144 012
f r e d \n
0000005
$ echo "" >> fred
$ od -bc fred
0000000 146 162 145 144 012 012
f r e d \n \n
0000006
$ |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Thankyou TonyFullerMalv
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| append a character at end of each line of a file | muaz | Shell Programming and Scripting | 4 | 06-25-2008 07:48 AM |
| How to add new line character at the end of a file | DebianJ | UNIX for Dummies Questions & Answers | 5 | 05-07-2008 03:22 PM |
| Need to serach if a new line character exists on the last line in a file | sunilbm78 | UNIX for Dummies Questions & Answers | 10 | 02-29-2008 01:15 PM |
| delete a line based on first character of the line | borncrazy | UNIX for Dummies Questions & Answers | 2 | 12-06-2005 02:27 PM |
| How would I replace the 9th character of every line in a file? | LordJezo | Shell Programming and Scripting | 5 | 09-01-2004 11:51 AM |
|
|