New answers tagged

1

sed, awk, others, many could do this. tr one: tr -d '"' < file The -d option is to delete things. And tr doesn't just read files, so use < to feed file content to it. It's same as: cat file | tr -d '"'


2

awk can do pipes "natively" itself, just like the redirections in the example. I'm not an awk quoting expert, but this matches your example & is reported to work A-OK: awk -F '[,/]' '{print | "xz -c >" filename$1$2$3".dat.xz"}'


0

Sed has the "change" command c to replace the whole current line: sed -i '1c\One h2 Three' file.csv This works with GNU sed. Others seds might need the text to be entered on a separate line: sed -i '1c\ One h2 Three' file.csv


0

I look back on this and the way that I ended up doing this is making a bash script like so called convert12345678.sh #!/opt/bin/bash (echo -e "ibase=16\nobase=0A" ; echo $1 | tr 'a-z' 'A-Z') | bc | tr "\n" " " | sed 's/\ //g' and then in gawk for whatever i needed say like in the op ( i have heavily modified that program since ) was something like this, ...


1

This should do it: http://stackoverflow.com/questions/11145270/bash-replace-an-entire-line-in-a-text-file The header should just be the first line in your file, so if you use N = 1, and rewrite the line with the desired headers, so: sed -i '1s/.*/One, h2, Three/' file.csv will do it


2

One of these: awk 'BEGIN {word[0]="YES"; word[1]="NO"} NR>1 {$2=word[$2]} 1' file perl -pe 's/(\d)$/ qw(YES NO)[$1] /e if $.>1' file To replace the file, you can use gawk -i inplace '...' file perl -i -pe '...' file



Top 50 recent answers are included