05-12-2009
i have the same problem. tried to do it with sed, but got no luck.
so i found my way to remove those ^M
cat -A input_file | tr -d ^M$ > output_file
works nice on my Debian.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm trying to remove the null characters from a file and copy it to std output.
I'm using emacs and I create the following one line bash file (followed by the error messages):
sed -e 's/^@//' <ConfigItemReplicator.install.log
/usr/bin/bash: -c: line 0: unexpected EOF while looking for... (1 Reply)
Discussion started by: siegfried
1 Replies
2. Shell Programming and Scripting
sed 's/^..//' file1.txt > file2.txt
this will remove the first two characters of each line of a text file, what sed command will remove the last two characters? This is a similar post to my other....sry if I'm being lazy....
I need a file like this (same as last post)
>cat file1.txt
10081551... (1 Reply)
Discussion started by: ajp7701
1 Replies
3. Shell Programming and Scripting
Here is my code.
for file in *1.3.html ; do mv "$file" `echo $file | tr '.1.3' ''` ; done
For some reason I am getting an error.
mv: file.idlesince.1.3.html and file.idlesince.1.3.html are identical
Could this be done a different way? (5 Replies)
Discussion started by: mrlayance
5 Replies
4. Shell Programming and Scripting
Hi All,
As all of us know that while moving a file from Windows to Unix some unwanted ^M characters appear in the file. For my case I have release package in zip format which looks like Module_Name_Tag.zip. It contains some directory structure...like
Module_Name_Tag.zip
|
|--trunk/... (2 Replies)
Discussion started by: bhaskar_m
2 Replies
5. Shell Programming and Scripting
Hi,
I have one file in the following format.
exa_resu_adj.4ge v.47645 PERSONAL INFORMAIONS PVT LTD 31 Dec 2009 04:36 Page 1
SALARY REPORT
Account Account Name CCode Bill No Balance T Amt
----------- ------------ ------- ---------- ------------- -------------
17490001 Mr Ram PM 10... (6 Replies)
Discussion started by: Kattoor
6 Replies
6. UNIX Desktop Questions & Answers
I tried using below command
tr -cd "" < InputFile.xml > output.txt ============= This removes all the tabs/newline/extra spaces from a file
it successfully removed all the extra spaces,tabs and new line characters but then the complete file become one record. I want to retain one new line... (1 Reply)
Discussion started by: saini
1 Replies
7. Shell Programming and Scripting
Hello
I've question on the requirement I am working on.
We are getting a fixed length file with "33" characters long. We are processing that file loading into DB.
Now some times we are getting a file with "35" characters long. In this case I have to remove two characters (in 22,23... (14 Replies)
Discussion started by: manasvi24
14 Replies
8. Shell Programming and Scripting
On SPARC Solaris 10. I set the app account so it's expired. I also want it
so not required to change password at first login, I can do this by
removing the numbers after the password in /etc/shadow.
example using user1
The /etc/shadow file looks like this:
user1:kOmcVXAImRTAY:0::::90::
... (8 Replies)
Discussion started by: TKD
8 Replies
9. Shell Programming and Scripting
i know , the below question has been repeated.
can you guys guide me .
I have the below input
999999 xxxxxxxxxxxxxx 123.45 2013-05-02 08:14 1 1 1 xxxx
999999 xxxxxxxxxxxxxx 123.45 2013-06-02 02:14 1 4 1 dddd
i need to remove from the column 54 to 70 , as like the below output.... (9 Replies)
Discussion started by: expert
9 Replies
10. Shell Programming and Scripting
How do I remove the printer escape sequence, the first 5 characters, that occurs on every 33rd line in a file, see hex dump of line 1.
0000 1e 00 00 00 00 0a 0a 0a 20 0a 20 20 20 20 20 20 ....
0010 20 20 20 20 20 20 20 20 20 20 0a 42 49 4c 4c 20
Thanks, (2 Replies)
Discussion started by: jgt
2 Replies
uniq(1) General Commands Manual uniq(1)
NAME
uniq - report repeated lines in a file
SYNOPSIS
fields] chars] [input_file [output_file]]
DESCRIPTION
reads the input text file input_file, comparing adjacent lines, and copies the result to output_file. If input_file is not specified, the
standard input and standard output are used. If input_file is specified, but output_file is not, results are printed to standard output.
input_file and output_file must not be the same file.
Line-Comparison Options
recognizes the following options when comparing adjacent lines:
Print those lines that are repeated in the original file.
Print copy only of each repeated line in the input file.
Generate an output report in default style
except that each line is preceded by a count of the number of times it occurred. If this option is specified, the and
options are ignored if either or both are also present.
If none of the options or are present, prints the results of the union of the and options, producing a copy of the original input file with
the second and succeeding copies of any repeated lines removed. (Note that repeated lines must be adjacent in order to be found -- see
sort(1)).
Field-Skip Options
Two options are provided for skipping an initial portion of each line when making comparisons:
Ignore the first
fields fields, together with any blanks before each. fields is a positive decimal integer. A field is defined as a
string of non-space, non-tab characters separated by tabs and/or spaces from its neighbors.
Ignore the first
chars characters. chars is a positive decimal integer. Each line in the input is assumed to be terminated with a
new line character for purposes of comparison. Fields are skipped before characters.
EXTERNAL INFLUENCES
Environment Variables
must be equal to the value it had when the input files were sorted.
determines the interpretation of text within files as single- and/or multi-byte characters, and defines a space character when the or
option is used.
determines the language in which messages are displayed.
If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization
variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
Exit values are:
0 Successful completion.
>0 Error condition occurred.
AUTHOR
was developed by OSF and HP.
SEE ALSO
comm(1), sort(1).
STANDARDS CONFORMANCE
uniq(1)