2) if we want to add a string in the end of each line of a text file and save it to a new file:
#!/bin/csh
# find each file starting with "input" and apply the changes
foreach i ( `ls input*` )
# get the last string in the filename separated by _
set append = `echo $i | awk '{split($0,a, "_");print a[6]}' `
# add _elim_1fois at the end of each line and save it to a new file
sed 's/$/_elim_1fois/' $i >> $i"_elim_1fois_"$append
sed 's/$/_elim_2fois/' $i >> $i"_elim_2fois_"$append
end
Aucun commentaire:
Enregistrer un commentaire