Posted: Wed 16 Jan 2013, 21:40 Post subject:
Get rid of strange characters in a file
I had a problem with strange characters appearing in a file that
I created.
Here's the script that caused the problem.
Code:
#!/bin/sh
top -n 1 > /tmp/top.tmp
sed -n '/Mem\:/p' /tmp/top.tmp > /tmp/top.tmp2 # find the MEMORY line
LINE=`cat /tmp/top.tmp2 | awk -F, '{ print $1 $2 }'`
echo $LINE >> /tmp/report-video
rm -f /tmp/top.tmp*
I solved it with just one line of additional code.
By the way most of these special characters appear to be two-byte.
Also note that I put a backslash in front of the character
to protect the character.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum