Processing a big file I some lines are not loaded, this append e.g with
$ cat load.py
import pandas as pd
df = read_csv('big.csv', on_bad_lines='warn')
$
using err and stdout:
$ python load.py 2> err.log
$
$ cat err.log
line 19585196: expected 6 fields, saw 7
line 19703832: expected 6 fields, saw 8
line 1117482923: expected 6 fields, saw 9
$
We get lines number in err.log (nothing to grep obviously)
Then I need to see what are this files with different structure:
$ sed -n -f '19585196p;19703832p;1117482923p' big.csv
It work very well, incredibly fast even with tremendous files.
My problem is when I have thousands lines to extract bash complain that the list is too long.
Let's put the sed command in a file (the real one with thousand of lines programmatically created in Python:
$ cat cmd.sed
# cmd
'19585196p;19703832p;111748p'
$
$ sed -f cmd.sed big.csv > /tmp/out
sed: file cmd.sed line 2: unknown command: `''
$