Baza znanja

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

Je li Vam ovaj odgovor pomogao?

 Ispiši članak

Također pročitajte

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 - Only keep certain country data

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

Linux - Download files through FTP

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

Linux - How to split large file

For this example we will split a large .csv into multiple files each "X" megabytes in size....

Linux - How to only keep X data

Firstly to start this you need to convert your .csv into a .txt mv filename.csv  filename.txt...