Request for advise on how to remove control characters in a UNIX file extracted from top command
Hi,
Please excuse for posting new thread on control characters,
I am facing some difficulties in removing the control character from a file extracted from top command,
i am able to see control characters using more command and in vi mode, through cat control characters are not visible
through cat -v i am able to see the control characters.
i tried with sed , tr -dc, od command (not sure how to handle this) nothing worked and thought of reading line by line and removing control characters but not sure how to remove the control characters, Could anyone please advise how to remove the control characters.
below is my file in vi mode having control characters
Code:
^[[7m PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ^[[m^O^[[K
^[[m^O12759 aaaa_a 16 0 100m 3188 2616 S 0.0 0.0 0:00.23 xxx aaaa_axxxxxx ^[[m^O
^[[m^O24435 aaaa_a 16 0 100m 3200 2624 S 0.0 0.0 0:00.19 xxx aaaa_axxxxxx ^[[m^O
^[[m^O25623 aaaa_a 15 0 100m 3192 2624 S 0.0 0.0 0:00.28 xxx aaaa_axxxxxx ^[[m^O
^[[m^O29634 aaaa_a 16 0 100m 3204 2632 S 0.0 0.0 0:00.35 xxx aaaa_axxxxxx ^[[m^O
Hi,
When I do a man and save it into a file, I end up getting a lot of control characters. How can I remove them??
I tried this:
/1,$ s/^H//g
But I get an error saying "no previous regular expression".
Can someone help me with this.
Thanks,
Aravind (5 Replies)
I have a file with millions of records...Before I experiment, I would like to know which one is faster.
Both the commands work absolutely fine on a smaller set of records.
Please advice.
sed 's/^M//g' ${INPUT_FILE} > tmp.txt
mv tmp.txt ${INPUT_FILE}
tr -d "\15" < ${INPUT_FILE} > ... (11 Replies)
Can anyone seem to know how to find out whether a UNIX text file has 'hidden' control characters?
Can I view them using 'vi' by some command line options?
If there are control characters in a text file which are invisible/hidden.. then how do I get rid of them?
Your intelletual answers are... (6 Replies)
Hi,
I have a .xml file in unix. We are passing this file through a xml parser.
But we are getting some control characters from input file and XML parser is failing for the control character in file.Now I am getting following error,
Error at byte 243206625 of file filename_$.xml:
Error... (1 Reply)
There are 10 files present which have Ctlr-M characters appended to each line of all files.
I have a unix script which processes the files in a loop.
And there is an inner loop which processes each line in the file concerned.
#inputFile is a variable which has the file name of the input... (2 Replies)
Hi,
I am using Cygwin.I created a new file and type into it using cat > newfile. When I open this using vi editor, it contains loads of extra control characters.
Whats happening? (1 Reply)
Hi,
My files are showing some control characters in vi editor
^M
^@ and somtimes
^H
I removed ^M with %s/^M//g command
but how to represent ^@ and ^H
e.g. for ^M it is hold ctrl then v and m..
Please help..
I am very new to unix.. (7 Replies)
Hello,
How can I view control and special characters of a text file?. For example, space, tabs, new line chars etc.
Can I use hexdump for it?
Thanks (3 Replies)
Hi Guys,
We receive some huge files on to Linux server. Source system use FTP mechanism to transfer these files on our server. Occasionally one record is getting corrupted while transfer, some control characters are injecting into the file. How to fix this issue ? please advice ?
Sample... (2 Replies)
Discussion started by: srikanth38
2 Replies
LEARN ABOUT BSD
ansitape
ANSITAPE(LOCAL) ANSITAPE(LOCAL)
NAME
ansitape - ANSI standard tape handler
SYNOPSIS
ansitape [key] [keyargs] [files]
DESCRIPTION
Ansitape reads and writes magnetic tapes written in ANSI standard format (called ``Files-11'' by DEC). Tapes written by ansitape are
labeled with the first 6 characters of the machine name by default. Actions are controlled by the key argument. The key is a string of
characters containing at most one function letter. Other arguments to the command are a tape label and file names specifying which files
are to be written onto or extracted from the tape.
The function portion of the key is specified by one of the following letters:
r The named files are written at the end of the tape. The c function implies this.
x The named files are extracted from the tape. If no file argument is given, the entire contents of the tape is extracted. Note
that if the tape has duplicated file names, only the last file of a given name can be extracted.
t The names of the specified files are listed each time they occur on the tape. If no file argument is given, all files on the tape
are listed.
c Create a new tape; writing begins at the beginning of the tape instead of after the last file. This command implies r.
The following characters may be used in addition to the letter which selects the function desired.
f This argument allows the selection of a different tape device. The next word in the keyargs list is taken to be the full name of a
device to write the tape on. The default is /dev/rmt12.
n The n option allows the user to specify as the next argument in the keyargs list, a control file containing the names of files to
put on the tape. If the file name is '-', the control file will, instead, be read from standard input. The control file contains
one line for each file to be placed on the tape. Each line has two names, the name of the file on the local machine, and the name
it is to have when placed on the tape. This allows for more convenient flattening of hierarchies when placing them on tape. If
the second name is omitted, the UNIX file name will be used on the tape also. This argument can only be used with the r and c
functions.
l The l option allows the user to specify the label to be placed on the tape. The next argument in the keyargs list is taken as the
tape label, which will be space padded or truncated to six characters. This option is meaningless unless c is also specified.
v Normally ansitape works relatively silently. The v (verbose) option causes it to type information about each file as it processes
it.
b The b option allows the user to select the blocksize to be used for the tape. By default, ansitape uses the maximum block size
permitted by the ANSI standard, 2048. Some systems will permit a much large block size, and if large files are being put on the
tape it may be advantageous to do so. Ansitape will take the next argument of the keyargs list as the blocksize for the tape.
Values below 18 or above 32k will be limited to that range. The standard scale factors b=512 and k=1024 are accepted.
Ansitape will not copy directories, character or block special files, symbolic links, sockets, or binary executables. Attempts to put
these on tape will result in warnings, and they will be skipped completely.
FILES
/dev/rmt12
DIAGNOSTICS
A warning message will be generated when a record exceeds the maximum record length and the affected file will be truncated.
BUGS
Ansitape quietly truncates names longer than 17 characters.
ANSI 'f' format files can be read but not written.
Multivolume tapes can not be handled.
4/10/85 UCB Local ANSITAPE(LOCAL)