Kunnskapsbase

Linux - Delete .csv column

Before you start you need to install

Ubuntu - sudo apt-get install libtext-csv-perl

CentOs - sudo yum install perl-Text-CSV


Then you need to download our script and assign the correct permissions. Place this script in the same folder your .csv files are in

wget http://195.154.61.188/script/deletecolumn.perl
chmod +x deletecolumn.perl

After downloading you need to edit the line below in deletecolumn.perl

print "\"$column[0]\",\"$column[2]\"\n";

By default this will only keep columns 0 and 2 (A and C, domainName and contactEmail)

0 = Column A
1 = Column B
2 = Column C
3 = Column D and so on...

Once you've edited it you need to run it using the following command

./deletecolumn.perl YourFileName.csv > YourNewFileName.csv

Var dette svaret til hjelp?

 Print

Les også disse

Linux - Delete lines with duplicate data

If for example you dont want the same email address to be in your .csv files you would run the...

Linux - Download files through FTP

To download all files recursively run the following command. wget -nc -np --reject "index.html*"...

Linux - How to delete .csv file containing "X" data

After extracting the .csv.gz files you can delete certain unwanted data by running the following...

Linux - Only keep certain country data

< FileToExtract.csv awk 'BEGIN {FS=","} tolower($19)~/usa|united states/' > USAList.txtThis...

Linux - How to extract .gz files (gunzip)

For this guide we will be using gunzip. You may need to installed it.CentOS - yum install gunzip...