bash - Delete <feff> from text file, UTF 8 -
i use bash script filter text 1 text file another. text encoded in utf 8.
#!/bin/bash mid=$1 infile="/var/www/tmp/textgrid_uploads/${mid}.txt" outfile="/home/var/www/vids/$mid/${mid}_textgrid.mlf" tmpfile="/home/var/www/vids/$mid/${mid}.tmp" i=1 touch $tmpfile cat $infile | grep "text =" | cut -d '"' -f2 | tr -d ',' | tr -d '.' | tr -d ':' | tr -d ';' | tr -d '!' | tr -d '?' > $tmpfile #| awk '{ print tolower($0) }' #cat $infile | grep -v "<" | egrep -v '^[[:space:]]*$' | tr -d '.' | tr -d "," | tr -d ";" | tr -d ":" | tr -d "^" | tr -d '#' | tr -d '?' | tr -d '!' | tr -d '%' | tr -d '@' | tr -d '*' | tr -d '~' | grep -v '((xxxxx))' | awk '{ print tolower($0) }' > $tmpfile #cat $infile | grep -v 'webvtt' | grep -v "\--" | grep -v '^$' | sed 's/?/./g' | sed 's/!/./g' | tr -d '.' | tr -d "," | tr -d ";" | tr -d ":" | awk '{ print tolower($0) }' > $tmpfile nlines=$(cat $tmpfile | wc -l) echo "#!mlf!#" >> $outfile echo "\"*/dummyfile.lab\"" >> $outfile while [ $i -le $nlines ] line=$(cat $tmpfile | sed $i'q;d') #zobrazi konkretny riadok printf '%s\n' $line | sed '/^\s*$/d' | cut -d "/" -f1 | egrep -v '^[[:space:]]*$' >> $outfile #zapis po riadkoch s odstranenim znaciek i=$[$i+1] #pocitadlo done echo "." >> $outfile rm $tmpfile
output of script is:
#!mlf!# "*/dummyfile.lab" <feff> v utorok o devätnástej bude vo fejs
i want remove first word feff both brackets. please give me whole example how it. new in bash , use script didn't create it. guys.
Comments
Post a Comment