Joined July 2014
·

Martin Marcher

European Union
·
·
·

Posted to Some Unix Copy/Find/Replace magic over 1 year ago

I think most of those are actually bad advice. for example the "Copy files with a matching pattern to a new directory" is subject to getconf ARG_MAX in the shell...

egrep ... | wc -l # useseless exec
egerp -c ....

egrep -Rl 'IP445A' ./*
find . -iregex 'IP445A' [-print|-ls]

cp `egrep -Rl "IP445A" ./*` ../matching/ # may exceep max command line arguments
find . -iname '*IP445A*' -exec cp {} ../matching/ + # not even xargs is needed + does the same
import csv
from StringIO import StringIO
file_like_obj = StringIO('value1,"oh look, an embedded comma",value3')
csv_reader = csv.reader(file_like_obj)
for row in csv_reader:
    print row[1]
    break
Achievements
1 Karma
0 Total ProTip Views
Interests & Skills