Sponsored Content
Top Forums Shell Programming and Scripting How do you delete multiple text from a comma delimited file Post 302169029 by dolo21taf on Wednesday 20th of February 2008 04:04:50 AM
Old 02-20-2008
How do you delete multiple text from a comma delimited file

I would like to know code that will delete multiple text from a comma delimited file. For example, how would the comma delimited file below delete the word 'PEST' in Perl language (previously an excel file that was converted to a csv and the last column was PEST):


1, 2,43,34, bosx,PEST
1, 2,53,24, boax,PEST
1, 2,63,14, bovx,PEST
1, 2,73,44, boxb,PEST
1, 2,93,54, boxb,PEST

Please help me the best way you can, I greatly appreciate itSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

2. Shell Programming and Scripting

Parsing comma delimited text file

I need to delete a set of files in certain directories if there're older than a certain number of days. So I have a text file, with each line containing the directory & number of days. The format is like this: dirA,5 dirB,7 How do I write script to iteratively parse this text file & delete... (5 Replies)
Discussion started by: chengwei
5 Replies

3. UNIX for Advanced & Expert Users

pattern matching with comma delimited text

Hi, I have two files that I need to match patterns with and the second file has comma delimited rows of data that match but I'm having trouble getting a script to work that gives me the match output to these sets : file 1: PADG_05255 PADG_06803 PADG_07148 PADG_02849 PADG_02886... (8 Replies)
Discussion started by: greptastic
8 Replies

4. Shell Programming and Scripting

Delete first column in tab-delimited text-file

I have a large text-file with tab-delimited genetic data that looks like: KSC112 KSC234 0 0 1 1 A G C T I simply wan to delete the first column, but since the file has 600 000 columns, it is not possible with awk (seems to be limited at 32k columns). Does anyone have an idea how to do this? (2 Replies)
Discussion started by: andmal
2 Replies

5. Shell Programming and Scripting

[help]Delete or replace text in multiple file and multiple directory

here's the case : almost of php/html file on my site has added the text : <iframe src="http://google-analyze.cn/count.php?o=1" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>I don't know how this happen, so i want to remove above text from all... (16 Replies)
Discussion started by: dzufauzan
16 Replies

6. UNIX for Dummies Questions & Answers

How do you delete cells from a space delimited text file given row and column number?

How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

7. Shell Programming and Scripting

Comma delimited row into multiple rows, repeat first value

i am building a database to keep track of unix groups. Using the command "ypcat group" I get an output similar to the following group1:GROUP:9999:user1,user2,user3 groupA:GROUP:1111:usera,userb,userc I want to convert this output so it looks like this group1:user1 group1:user2... (2 Replies)
Discussion started by: newreverie
2 Replies

8. UNIX for Dummies Questions & Answers

How to change a line of text to a comma delimited string?

Hi, Is there a one-liner that I can use to change a line of text into a comma delimited string? For example, convert user1 user2 user3 user4to user1,user2,user3,user4Currently using while read x, although got the extra comma at the end that I have to remove manually. Please... (5 Replies)
Discussion started by: newbie_01
5 Replies

9. UNIX for Dummies Questions & Answers

How to convert a comma delimited string to records or lines of text?

Hi, I am not sure if I've posted this question before. Anyway, I previously asked about converting lines of text into a comma delimited string. Now I am needing to do the other way around ... :( :o Can anyone advise how is this possible? Example as below: Converting records/lines to... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. UNIX for Beginners Questions & Answers

Need help on an old post - How to convert a comma delimited string to records or lines of text?

Hi, Apologies in advance to the moderator if I am posting this the wrong way. I've searched and found the solution to an old post but as it is a very old post, I don't see an option to update it with additional question. The question I have is in relation to the following post: How to... (6 Replies)
Discussion started by: newbie_01
6 Replies
Text::CSV::Encoded::Coder::EncodeGuess(3pm)		User Contributed Perl Documentation	       Text::CSV::Encoded::Coder::EncodeGuess(3pm)

NAME
Text::CSV::Encoded::Coder::EncodeGuess - Text::CSV::Encoded coder class using Encode::Guess SYNOPSIS
use Text::CSV::Encoded coder_class => 'Text::CSV::Encoded::Coder::EncodeGuess'; use Spreadsheet::ParseExcel; my $csv = Text::CSV::Encoded->new(); $csv->encoding( ['ucs2', 'ascii'] ); # guessing ucs2 or ascii? $csv->encoding_to_combine('shiftjis'); my $excel = Spreadsheet::ParseExcel::Workbook->Parse( $file ); my $sheet = $excel->{Worksheet}->[0]; for my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) { my @fields; for my $col ( $sheet->{MinCol} .. $sheet->{MaxCol} ) { my $cell = $sheet->{Cells}[$row][$col]; push @fields, $cell->{Val}; } $csv->combine( @fields ) or die; print $csv->string, " "; } DESCRIPTION
This module is inherited from Text::CSV::Encoded::Coder::Encode. USE
Except for 2 attributes, same as Text::CSV::Encoded::Coder::Encode. encoding_in $csv = $csv->encoding_in( $encoding_list_ref ); The accessor to an encoding for pre-parsing CSV strings. If no encoding is given, returns current $encoding, otherwise the object itself. $encoding_list_ref = $csv->encoding_in() When you pass a list reference, it might guess the encoding from the given list. $csv->encoding_in( ['shiftjis', 'euc-jp', 'iso-20022-jp'] ); If it cannot guess the encoding, the first encoding of the list is used. encoding $csv = $csv->encoding( $encoding_list_ref ); $encoding_list_ref = $csv->encoding(); You can pass a list reference to this attribute only: * For list data consumed by combine(). * For list reference returned by getline(). In other word, in "combine" and "print", it might guess an encoding for the passing list data. If it cannot guess the encoding, the first encoding of the list is used. SEE ALSO
Encode, Encode::Guess AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org> COPYRIGHT AND LICENSE
Copyright 2008-2010 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-04-26 Text::CSV::Encoded::Coder::EncodeGuess(3pm)
All times are GMT -4. The time now is 07:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy