New answers tagged

1 vote

Command line friendly spreadsheets

There is sc-im, which is "sc Improved". While based on the original sc, there are some differences between sc-im and sc, as seen from the linked page. Notably, sc-im supports undo/redo, ...
husB's user avatar
  • 111
1 vote

How to remove embedded newlines from CSV fields

Using TXR: $ txr fix.txr data "host1","host1","linuxserver","" "host2","host2","linux server","" "host1","...
Kaz's user avatar
  • 8,476
3 votes

How to remove embedded newlines from CSV fields

Using any awk: $ awk 'BEGIN{RS=ORS="\""} !(NR%2){gsub(/\n/," ")} 1' file.csv "host1","host1","linux server","" "host2","...
Ed Morton's user avatar
  • 31.7k
4 votes

How to remove embedded newlines from CSV fields

Using Raku (formerly known as Perl_6) Inspired by @terdon's excellent Perl answer: ~$ raku -ne '/ <!after \" > $/ ?? print "$_ " !! put $_;' file Here are answers written in ...
jubilatious1's user avatar
  • 3,225
2 votes

How to remove embedded newlines from CSV fields

We assume that despite many unwanted line breaks all double quotes match and all field separators are present. In that case you could use this command: $ sed '/^"/! s/^/ /' infile | tr -d '\n' | ...
user9101329's user avatar
  • 1,069
6 votes
Accepted

How to remove embedded newlines from CSV fields

The last thing you want to do is try to do this in bash. See Why is using a shell loop to process text considered bad practice?. Now, if what you want can be expressed as "remove any newline ...
terdon's user avatar
  • 242k
7 votes

How to remove embedded newlines from CSV fields

Using Miller (mlr), a CSV-aware multi-purpose processing utility for various structured document formats, to clean up the whitespace of all fields: $ cat file "host1","host1","...
Kusalananda's user avatar
  • 334k
0 votes

How to remove embedded newlines from CSV fields

Some modern implementations of awk actually bring a fully-fledged csv parser (I think it's GoAWK?), yours probably doesn't. GNU awk starting from 5.3 have the --csv flag. You would need to have a very ...
Marcus Müller's user avatar
1 vote

Add list of urls to the Qutebrowser’s sqlite3 history

SQLite doesn't enforce column types, and the time columns in cutebrowser's history SQL are simple integers (probably seconds since epoch). Yours are full strings with ISO-formatted date-times! So, ...
Marcus Müller's user avatar
0 votes

A unix command to truncate each line of a file

Using Perl ~$ perl -lane ' @F = split(";"); print join ";", @F[0..2];' file Using Raku (formerly known as Perl_6) $~ raku -ne 'my @F = .split(";"); put join &...
jubilatious1's user avatar
  • 3,225
0 votes

Certain file types not showing in Ranger preview

The "type" is just something that the file utility guesses based on the heuristics it's been given. There's nothing to fix here, honestly: your comma-separated values are comma-separated ...
Marcus Müller's user avatar
0 votes

Is there a command line utility to transpose a csv-file?

You can transpose with an awk one-liner: $ awk 'BEGIN{FS=OFS=","}{ for (i=1; i<=NF; i++) a[i]= (i in a?a[i] OFS :"")$i}END{ for (i=1; i<=NF; i++) print a[i] }' input_file ...
user9101329's user avatar
  • 1,069

Top 50 recent answers are included