09-14-2011
awk does not like windows text files - You need to strip the trailing carriage return from \r\n to just a \n.
dos2unix (or called dos2ux sometimes) does just that.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My file in ksh consists of message data of varying lengths (lines), separated with headers.
I would like to find a string from this file, and print out the whole message data including the headers.
my plan of attack is to search the strings, print the top header, and print the whole message... (2 Replies)
Discussion started by: apalex
2 Replies
2. Shell Programming and Scripting
Dear All ,
I am posting first time in this forum . Please ignore my mistakes .
I am learning Unix and i need help to extract specific data from file .
1. I want to grep number of fails from log . The file contains "fails" word in line if test cases are failed .
2. The log contains... (20 Replies)
Discussion started by: getdpg
20 Replies
3. Shell Programming and Scripting
I m new to shell scripting & i need a help....
i have file like....
Name := sachin
address:=something
phone:=111
...
Note: There might be or not space between Name & := and between := & sachin. I need to extract the data from each line of file as
var1=Name
value1=sachin
same for... (13 Replies)
Discussion started by: ps_sach
13 Replies
4. UNIX for Dummies Questions & Answers
I have a file having name smthing.tar.bz2-00
I am trying to unzip it using
tar -xvjf "name"
But I am not able to unzip it.
PLease advise for the issue. (3 Replies)
Discussion started by: nixhead
3 Replies
5. Shell Programming and Scripting
Hi, Great minds, I have some files, in fact header files, of CTD profiler, I tried a lot C programming, could not get output as I was expected, because my programming skills are very poor, finally, joined unix forum with the hope that, I may get what I want, from you people,
Here I have attached... (17 Replies)
Discussion started by: nex_asp
17 Replies
6. Shell Programming and Scripting
Hello All,
I have a small xml file which looks like below:
<Check:defaultval Val="crash" value="crash_report_0013
generate_check_0020 generate_check_0022

This is where the fault is."/>
<Check:defaultval Val="crash" value="crash_report_1001
generate_check_1001... (9 Replies)
Discussion started by: suvendu4urs
9 Replies
7. Shell Programming and Scripting
I have a text file that contains the following data. For example, aa.txt has some numbers. I need to extract the continuous numbers(minimum 3 numbers) from it.How can I do this with awk?
>aa.txt
31
35
36
37
38
39
44
169
170
173
174
175
177
206
>1a.txt
39 (5 Replies)
Discussion started by: rahmanabdulla
5 Replies
8. Shell Programming and Scripting
Hi ,
I am having a file which is PIPE delimited like this :
file.txt
aus|start|10:00:00
nz|start|11:00:00
aus|end|10:10:00
us|start|10:00:00
nz|end|11:10:00
us|end|11:00:00
.
.
.
I want to extract an output file like this based on start time and end time for each countries: (9 Replies)
Discussion started by: rohit_shinez
9 Replies
9. Red Hat
Linux 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
Hi all,
I am unable to extract .gz file using gunzip
Used the following command to create the .gz file:
nohup tar -cvpf - 11.2.0.4 | gzip -c >... (3 Replies)
Discussion started by: a1_win
3 Replies
10. Shell Programming and Scripting
file2 content
f1file2 content
f1,1,2,3,4,5
f1,2,4,6,8,10
f10,1,2,3,4,5
f10,2,4,6,8,10
f5,1,2,3,4,5
f5,2,4,6,8,10awk 'FNR==NR{a;next}; !($1 in a)' file2 file1output
f10,1,2,3,4,5
f10,2,4,6,8,10
f5,1,2,3,4,5
f5,2,4,6,8,10awk 'FNR==NR{a;next}; ($1 in a)' file2 file1output
nothing... (4 Replies)
Discussion started by: gksenthilkumar
4 Replies
LEARN ABOUT REDHAT
mac2unix
dos2unix(1) General Commands Manual dos2unix(1)
NAME
dos2unix - DOS/MAC to UNIX text file format converter
SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
Options:
[-hkqV] [--help] [--keepdate] [--quiet] [--version]
DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format.
OPTIONS
The following options are available:
-h --help
Print online help.
-k --keepdate
Keep the date stamp of output file same as input file.
-q --quiet
Quiet mode. Suppress all warning and messages.
-V --version
Prints version information.
-c --convmode convmode
Sets conversion mode. Simulates dos2unix under SunOS.
-o --oldfile file ...
Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used.
-n --newfile infile outfile ...
New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be
used or you WILL lost your files.
EXAMPLES
Get input from stdin and write output to stdout.
dos2unix
Convert and replace a.txt. Convert and replace b.txt.
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix
ascii format.
dos2unix a.txt -c iso b.txt
dos2unix -c ascii a.txt -c iso b.txt
dos2unix -c mac a.txt b.txt
Convert and replace a.txt while keeping original date stamp.
dos2unix -k a.txt
dos2unix -k -o a.txt
Convert a.txt and write to e.txt.
dos2unix -n a.txt e.txt
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt.
dos2unix -k -n a.txt e.txt
Convert and replace a.txt. Convert b.txt and write to e.txt.
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt.
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me.
AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au>
Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org>
MISCELLANY
Tested environment:
Linux 1.2.0 with GNU C 2.5.8
SunOS 4.1.3 with GNU C 2.6.3
MS-DOS 6.20 with Borland C++ 4.02
Suggestions and bug reports are welcome.
SEE ALSO
unix2dos(1) mac2unix(1)
1995.03.31 dos2unix v3.0 dos2unix(1)