In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data
My issue is i am not able to get header for column from raw file into new file which is generated by below command.
KE|KE_OUTWARD_B2B_OSR_TT_TT_201025_V1.0.txt|30|||Outward|KAR|PO|082017|29AAACT24|INV|TAX|3010482048|2017-11-03||||1|29AAACH27|||M/s HD . LTD||||29||||||9984||Tel Ser|||||0.00|0.00|9.00|45.00|9.00|45.00|||||590.00||||||||||
Please become accustomed to provide decent context info of your problem.
It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two including your own attempts at a solution, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.
Hi as7951,
Expanding greatly on what RudiC said...
Instead of telling us "in short" what you're trying to do, please tell us exactly what you're trying to do in full.
It should be obvious that there is nothing in the code you showed us above that will print a header line. What isn't know includes:
Does the header line you want in the output file appear as the 1st line in your input file, or does the header need to be created manually?
Should that header line always appear in your output file, or should it only appear if the another output line is written to that file?
If that file is created will it only contain two lines (the header and the line shown above), or might other errors also be logged into that file?
Is the awk code shown above your entire awk script, or is it another abbreviation that would be likely to significantly alter the suggestions we might make to address your problem?
What operating system are you using?
The more you tell us about what you're trying to do and the environment in which you're working, the more likely we are to be able to help you with suggestions that might do what you want in your environment. The less you tell us, the more likely it is that we won't understand what you want and will make suggestions that won't do what you want or won't work in your environment.
Please help us help you by giving us the details we need to understand what you're trying to do.
Would csplit help here? You can put in a regular expression to split the file on.
Have a read of the manual page and see if that does what you need, then have a go and see if it does what you need. If it's close, but not right or you can't get it working at all, post the details and your efforts so we can see about helping.