Skip to main content

All Questions

3 votes
5 answers
1k views

Replace a block of spaces with a comma

I have a file in txt format that I want to convert to csv. Between each field there are blocks of spaces. The amount of spaces is not the same between every field. Is there a command with sed or awk ...
pwrsheller's user avatar
0 votes
2 answers
3k views

Replace content of a specific column in a CSV with sed

I have several CSV log files and want to replace the status codes stored in the 8th column of these log files with a description The log files looks like this: ip,date,time,zone,cik,accession,...
BillyRater's user avatar
1 vote
4 answers
99 views

Given Pattern Replacement With Comma

Below follows test.txt contents, with generally 22 columns: BusinessDate,SourceSystemId,IceIndexId,IceIndexName,ComponentId,ComponentReferenceType,ComponentType,ComponentName,ComponentIssuerCIS,...
Rabindra Panigrahi's user avatar
1 vote
0 answers
388 views

Large file processing performance

I did a simple performance test of csv processing a while ago, and want to share results with community, maybe you can point out, what test could be more precise and fair. Firstly i took out 42 MB ...
nonForgivingJesus's user avatar
0 votes
3 answers
2k views

Unintended line breaks in csv file

I have a csv file with some unintended line breaks. The file looks more or less like this: col1; col2; col3; col4 1a; 1b; 1c; 1d 2a; 2b; 2c ;2d # this should be ...
Alex's user avatar
  • 105
-1 votes
3 answers
110 views

manage comma seperated-fields

I do have a big data inside text file as the following format: x, xx, xxx, xxxx, , , , x, xx, , xxxx, xxxx, so i would like to delete from file all lines which field number 3 after comma is empty so ...
αԋɱҽԃ αмєяιcαη's user avatar
2 votes
3 answers
1k views

How to replace single or double space in a text file when between quotes

I have a CSV file with some fields quoted, but the entries within quotes are separated by double or single spaces. I need these to be replaced with commas. Example line: This is okay,"ABC DEF GHI",...
TomNash's user avatar
  • 121
2 votes
5 answers
509 views

Duplicate lines and make them unique?

I have the following structure of text lines: 3923 001 L05 LV,L05 RM 3923 002 L12 RA,L12 LA 3923 003 I06 ALL 3923 004 G04 RV,Z09 ALL but i would need this: 3923 001 L05 LV 3923 001 ...
Randy V's user avatar
  • 23
4 votes
2 answers
25k views

Print some fields of /etc/passwd

I have a question concerning the usage of wild cards in Linux. Here I have some lines from a long list of lines in the /etc/passwd -file. root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/...
cash's user avatar
  • 183