You're viewing a comment by Peter Krumins and its responses.

March 23, 2015, 19:11

You don't need to loop over files. You can use sed's -i argument. This argument replaces data in-place and rewrites the file, and creates a backup .bak version of the file.

Here's how you do it:

sed -i.bak '1d; s/^[^,]\+,//; s/^\s\+//' *.csv

Explanation:

1d delete the first line and goes to next line.

s/^[^,]\+,// delete everything from the start to the first comma.

s/^\s\+// cleanups any whitespace at the beginning.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "lcd_122": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.