Initializing columns to NULL an saving data to a new file

Hi

I've been trying to delete columns from a file, and the best option I could come up was to initialise them to NULL.

The reason for this is because I need to compare the differences between 2 files with those specific columns excluded.

Here is my script:

 
#!/bin/bash
#---------------------------------------------------------------------#This script removes the datetime stamp and pipes the data from the old #file to a new file for comparison
#---------------------------------------------------------------------awk -F; -v oldfile="$1" -v newfile="$2" '{$13=$14=$15=""1}' OFS="," $1 > $2

I parse oldfile1.csv to the script:

 
User Parameter;Entity Name;Cell ID;Type SubCell / TX / FHSY / DRI / TDMA;Instance CHGR / TX / FHSY / DRI / TDMA;CellR ID;Vendor Parameter;Planned Value;Translated Value;Network Value;Override Level;Override Node;Override Value;Planned Date;Network Date;Vendor;Technology;Version
Access Grant Blocks Reserved;CELL;1A;;;;AGBLK;5;5;1;CELL;1A;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;07B
Access Grant Blocks Reserved;CELL;1B;;;;AGBLK;2;2;1;CELL;1B;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;07B
Access Grant Blocks Reserved;CELL;1C;;;;AGBLK;3;3;1;CELL;1C;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;07B
Access Grant Blocks Reserved;CELL;2A;;;;AGBLK;7;7;1;CELL;2A;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B
Access Grant Blocks Reserved;CELL;2B;;;;AGBLK;4;4;1;CELL;2B;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B
Access Grant Blocks Reserved;CELL;2C;;;;AGBLK;0;0;1;CELL;2C;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B
Access Grant Blocks Reserved;CELL;3A;;;;AGBLK;1;1;1;CELL;3A;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B
Access Grant Blocks Reserved;CELL;3B;;;;AGBLK;6;6;1;CELL;3B;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B
Access Grant Blocks Reserved;CELL;3C;;;;AGBLK;4;4;1;CELL;3C;;4/6/2010 9:01:17 AM;1/12/2010 5:15:15 AM;ERICSSON;GSM;08B

It should initialise the fields with date time stamp to NULL and then parse this new data to another file called newfile1.csv (newfile1.csv currently does not exist)

I run the script:

 ./export_data_clean.sh oldfile1.csv newfile1.csv

Here is my log results:

 
$ ./export_data_clean.sh oldfile1.csv newfile1.csv
awk: option requires an argument -- F
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options:          GNU long options:
        -f progfile             --file=progfile
        -F fs                   --field-separator=fs
        -v var=val              --assign=var=val
        -m[fr] val
        -W compat               --compat
        -W copyleft             --copyleft
        -W copyright            --copyright
        -W dump-variables[=file]        --dump-variables[=file]
        -W exec=file            --exec=file
        -W gen-po               --gen-po
        -W help                 --help
        -W lint[=fatal]         --lint[=fatal]
        -W lint-old             --lint-old
        -W non-decimal-data     --non-decimal-data
        -W profile[=file]       --profile[=file]
        -W posix                --posix
        -W re-interval          --re-interval
        -W source=program-text  --source=program-text
        -W traditional          --traditional
        -W usage                --usage
        -W version              --version
To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
Examples:
        gawk '{ sum += $1 }; END { print sum }' file
        gawk -F: '{ print $1 }' /etc/passwd
./export_data_clean.sh: line 6: -v: command not found

I have no idea what is wrong here, can you please assist me.

You have to quote the semicolon in the commandline, like

awk -F';' ...

I have tried this, and I don't get any errors. However, the newfile is generated as an empty file. How do I parse the data after those rows are initialised to NULL to a new file?

You do not have any output statements in your awk script. This worked for me:

awk -F';' '{$13=$14=$15="";print;}' OFS="," $1 >$2

Thank you for your help. It works now.