Search Results

Search: Posts Made By: Scrutinizer
4,669
Posted By Scrutinizer
Try: #!/usr/bin/gawk -f BEGIN{FS=OFS="|"} ...
Try:
#!/usr/bin/gawk -f

BEGIN{FS=OFS="|"}

{
<do my stuff 1>

# need to remove empty fields at this stage

gsub(/^\||\|$/,x)
gsub(/\|\|/,FS)

# need to keep going with...
4,669
Posted By Scrutinizer
Yes x is a variable, and since it has not been...
Yes x is a variable, and since it has not been initialized, it contains the value ""
4,669
Posted By Scrutinizer
You would need to do something like this to shift...
You would need to do something like this to shift the fields:
awk '{for(i=1; i<=NF; i++) if($i=="") for(j=i;j<=NF;j++)$j=$(j+1)}1' FS=\| OFS=\| infile
output:
1|2|3|4|5|6||
But that still leaves...
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 12:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy