My input file is Pipe delimited with 10 fields, I am trying to create a tab delimited output file with 6 fields from the provided input file.
Below is sample data
Input file
abc||2|PIN|num||||www.123.com|abc@123.com|
bcd||2|PIN|num|||||abc@123.com|
efg||2|PIN|num||||www.123.com|abc@123.com|
dbd||2|PIN|num|||||abc@123.com|
Expected Output file(tab delimited)
abc 2 PIN num www.123.com abc@123.com
bcd 2 PIN num abc@123.com
efg 2 PIN num www.123.com abc@123.com
dbd 2 PIN num abc@123.com
I am able to convert the file into tab delimited output using awk -F"|" 'BEGIN{OFS="|"}{print $1" , however the output file generated has issues for somoe records with NULL URLs(www.123.com)
Sample data from my Output file
abc 2 PIN num www.123.com abc@123.com
bcd 2 PIN num abc@123.com
efg 2 PIN num www.123.com abc@123.com
dbd 2 PIN num abc@123.com
What I need is in the case of a blank URL it should be replaced by tab or 'NA'
Can some one please help is achieving the desired output file ?
Thank you
Raghs,