![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Changing one column of delimited file column to fixed width column | manneni prakash | Shell Programming and Scripting | 5 | 06-22-2009 05:27 AM |
| how to read the column and print the values under that column | gemini106 | Shell Programming and Scripting | 6 | 03-28-2008 07:05 AM |
| How to check Null values in a file column by column if columns are Not NULLs | Mandab | Shell Programming and Scripting | 7 | 03-15-2008 09:57 AM |
| How to pass one parameter from one column to another column in AWK | prasanta jena | Shell Programming and Scripting | 1 | 07-30-2007 06:08 AM |
| Replace 10th column with a new column--- Terriblly hurry | ahmedwaseem2000 | Shell Programming and Scripting | 2 | 09-06-2005 01:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Column scattered onto multiple new lines
Hi All,
I am getting a pipe separated flat file which is to be loaded into the database. The issue is that the last column of the record is scattered onto multiple new lines. Ideally one record should be on a single line ( Please refer the last three lines of the attached flat file) but in this case the flat file generation utility is not generating it correctly and I have to live with this problem Will really appreciate if anybody would be able to give some solution to fix this issue. Thanks in advance. Last edited by SUMNIX; 08-07-2008 at 08:29 AM.. Reason: incomplete subject line |
|
||||
|
I am running it on Solaris and used xpg4 version of awk to execute the below awk script. I have removed the RS and ORS variables cause they were not helping in output file generation.
awk -F\| 'END { print _ } NF > 1 && _ { print _ ; _ = "" } { _ = _ ? _ $0 : $0 } flat_file.txt The output file which i got is still not the correct one. The original file records are having 9 fields separated by "|" I am running the awk which is creating one more records at the start and it is putting the scattered column charaters at the begining of the record. In short it is creating one more record at the beginning and in some cases it is loosing the characters. Please observe the second record in the attached output file which I got after running the above awk. Please help in generating the correct flat file. Thanks... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|