10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty.
I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
2. Shell Programming and Scripting
The awk below executes and produces the current output, which is correct, except I can not seem to include the header lines # and ## in the output as well. I tried adding !/^#/ thinking that it would skip the lines with # and output them but the entire file prints as is. Thank you :).
... (8 Replies)
Discussion started by: cmccabe
3. UNIX for Dummies Questions & Answers
I'm trying to sort 2 different .txt tab delimited files with the command line:
sort -k 1b,1 inputfile > outputfile
But doing that i'm also sorting the header (that ends at the end of my file).
How can i sort a .txt file without sorting the header but conserving the header in the... (3 Replies)
Discussion started by: alisrpp
4. UNIX for Dummies Questions & Answers
Is there a way to write to a txt file each day but retain the header on the file? I'm cat'ing 5 files into one .txt file each day but I want the new data to be written after the first 2 lines which are:
Progname Size Date Owner
Basically I want my new... (4 Replies)
Discussion started by: Grueben
5. Shell Programming and Scripting
I am writing a perl script which checks for the specific column values from a file and writes to the OUT file.
So the feed file has a header information and footer information.
I header information isaround107 lines i.e.
so on ....
... (11 Replies)
Discussion started by: filter
6. UNIX for Dummies Questions & Answers
How can i tweak sendmail configuration files so that the "Received:" field is removed from email header information?
Or else can i change Received: (from enswitch@localhost) in email header to something likeReceived: (from xyz@localhost)?
---------- Post updated at 09:57 PM ---------- Previous... (2 Replies)
Discussion started by: proactiveaditya
7. Shell Programming and Scripting
I have large file with around 100k+ lines. I wanted to retain only the last 100 lines in that file. One way i thought was using
tail -1000 filename > filename1
mv filename1 filename
But there should be a better solution.. Is there a way I can use sed or any such command to change the... (9 Replies)
Discussion started by: nss280
8. Shell Programming and Scripting
There are directories of files that I have to run the dos2ux command on to get ride of the carriage return characters. Easy enough, but I have to retain the original timestamps on the files. I am thinking that I am going to have to strip off the timestamp for each file and convert it to unix time... (3 Replies)
Discussion started by: scotbuff
9. Shell Programming and Scripting
I have written a bash script that I am sharing with an OS X community I am a member of. The purpose of the script is to execute a series of commands for members without them having to get involved with Terminal, as it can be daunting for those with no experience of it at all. I have renamed... (4 Replies)
Discussion started by: baza210
say i have these many file in a directory named exam.
and i create a tar say exam.tar
well the problem is,
when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories.
on the... (2 Replies)
Discussion started by: Tanvirk
dos2unix(1) General Commands Manual dos2unix(1)
dos2unix - DOS/MAC to UNIX text file format converter
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
[-hkqV] [--help] [--keepdate] [--quiet] [--version]
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format.
The following options are available:
Print online help.
Keep the date stamp of output file same as input file.
Quiet mode. Suppress all warning and messages.
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.
Get input from stdin and write output to stdout.
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
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
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me.
Benjamin Lin - <email@example.com>
Bernd Johannes Wuebben (mac2unix mode) <firstname.lastname@example.org>
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.
1995.03.31 dos2unix v3.0 dos2unix(1)