06-30-2015
You can do it with just replacing the 4th column
awk '{print $1,$2,$3,"1"}' input.txt > output.txt
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to parse a file and use each record to create a unique file
where the name of the file created is taken from the 3rd field.
Example: here are 3 records.
000007 0110 07-0001583 20060802132213 20060801112601
000007 0110 07-0001584 ... (4 Replies)
Discussion started by: zoo591
4 Replies
2. Programming
Hi there.
I've got 12 years experience writing C++ on Windows, and 3 years C# on Windows. Now my boss wants me to write a C++ app to run on Unix as a multithreaded 'service' (i.e. a program that runs with no user intervention).
Some quick questions for The Experts:
* Whats the best C++... (3 Replies)
Discussion started by: Rutland Gizz
3 Replies
3. Shell Programming and Scripting
Hello all
I have a file with below data, I need to add a third column as XXXX if the first coloumn (H180620081) last number is "1"
and YYYY if the first coloumn last number is "2"
Can it be done with AWK, I would appreciate if anyone could help me ou with this.
H180620081 31310 ... (11 Replies)
Discussion started by: udaybo
11 Replies
4. Shell Programming and Scripting
Hi all,
I have an awk basic question.
file.text
Our Location:
Our home has light yellow siding,
and is a duplex on Main Street,
across from the High School,
and across the lane from the Health Center
If I run:
cat file.txt | awk '{print $2}' | grep... (7 Replies)
Discussion started by: research3
7 Replies
5. UNIX for Dummies Questions & Answers
I have a script problem that I am not able to solve due my very limited understanding of unix/awk.
This is the contents of test.sh
awk '{print $1}'
From the prompt if I enter:
./test.sh Hello World
I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello... (2 Replies)
Discussion started by: JasonHamm
2 Replies
6. Shell Programming and Scripting
Hi there, greetingt to everybody.
I have configured syslog-ng to get messages over UDP saving logs into a text file, it works fine.
I need to store the content of this file in several files depending from some criteria that I try to explain you with some examples :
Suppose the content of my log... (5 Replies)
Discussion started by: capnino
5 Replies
7. UNIX for Dummies Questions & Answers
Hey guys I searched for this for the past few hours but maybe I dont know what the heck I am searching for.
I am looking how to locate my .profile and where the heck I can find it to be able to edit it.
Thanks in advance. (11 Replies)
Discussion started by: Koopa_Troopa
11 Replies
8. UNIX for Dummies Questions & Answers
what is a assembler
what isa interpreter
what is a compiler
what is a socket
what is a port
what is meant by listening to a port how we do it
how to know version and standard of unix one is using when one is on public access unix account
how to see a jobid in... (1 Reply)
Discussion started by: scimitar
1 Replies
9. Shell Programming and Scripting
I find an script with awk sitting around. I went through some online manuals, but I can't figure out exactly how it works. I can't post the whole program. Not allowed.
This is the line that is confusing me. I get when else is in the script
grep -v "^REM " $1| grep -v "JUNK;" | awk -F" "... (2 Replies)
Discussion started by: guessingo
2 Replies
10. UNIX for Dummies Questions & Answers
Im sure this is an easy question, but Ive tried and tried to get this to print all on one line and cant figure out why its not, so maybe someone can help
awk '/AP/{sub(/:80/, "", $4);printf $4"\t"} /User-Agent/{sub(/^*:/,"");print};sub(/\.80/,"", $4);/Host/{sub(/^*:/,""); print}'
What this... (10 Replies)
Discussion started by: sectech
10 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)