Sponsored Content
Full Discussion: awk read input files
Top Forums Shell Programming and Scripting awk read input files Post 302352098 by danmero on Thursday 10th of September 2009 11:13:33 AM
Old 09-10-2009
# cat skript.awk

# gawk -f skript.awk file2 file1 > file3

# cat file3
180    P    01.01.2008    30.06.2008    2
1101    P    01.12.2008    31.12.2008    3


10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

2 input files for awk

Hi, i have 2 files like f1 and f2 f1: 1 Note: some times it will be cahnged to 2 and 3. f2: 1:20 2:30 4:50 6:70 8:90 3:20 1:30 1:40 output: 1:80 (sum of 1) (6 Replies)
Discussion started by: koti_rama
6 Replies

2. Shell Programming and Scripting

read input from 2 files and print them in alternate columns

Hi Frnz Please help me out. I have two text files. A.txt one two three four B.txt Jan Feb Mar Apr I need the output as (1 Reply)
Discussion started by: sriram.s
1 Replies

3. Shell Programming and Scripting

Splitting input files into multiple files through AWK command

Hi, I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below for file in *.txt do grep -i -h "value1|value2" $file > $file; done. My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Discussion started by: arund_01
3 Replies

4. Shell Programming and Scripting

Comparing 2 input files -Awk

Compare 2 files and print the values input1 (c1 20 100 X_y10) along with one closest highest (c1 100 200 X_y10) and one lowest values (c1 10 15 X_y10) from input2 input1 c1 20 100 X_y10 input2 c1 5 10 X_y10 c1 10 15 X_y10 c1 100 200 X_y10 c1 200 300 X_y10 output ... (8 Replies)
Discussion started by: bumblebee_2010
8 Replies

5. Shell Programming and Scripting

Script to read input and output files and child scripts

I have a directory where i have *.sas; *.pl;*.sh and *.c scripts I need to find out what are the child scripts and input output files for each script: say I have a shell script which calls a perl script and a sas script: In my first line I want I a) the parent script name; b) the... (1 Reply)
Discussion started by: ramky79
1 Replies

6. Shell Programming and Scripting

AWK using two input files

Hi , i have two input files one is input.gz and another is ( input.txt) text file.in gz format input file each record contains 10 fields and corresponding header value is present in the text file as a single record i.e text file contains only 10 records which is header value,so output of the awk... (1 Reply)
Discussion started by: Ajoy
1 Replies

7. Shell Programming and Scripting

Read input file with in awk script not through command line

Hi All, Do we know how to read input file within awk script and send output toanother log file. All this needs to be in awk script, not in command line. I am running this awk through crontab. Cat my.awk #!/bin/awk -f function test(var){ some code} { } END { print"test code" } (5 Replies)
Discussion started by: random_thoughts
5 Replies

8. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

9. Shell Programming and Scripting

Parse input of two files to be the same in awk

I have two files that I am going to use diff to find the differences but need to parse them before I do that. I have include the format of each file1 and file2 with the desired output of each (the first 5 fields in each file). The first file has a "chr" before the # that needs to be removed. I... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
CAT(1)							    BSD General Commands Manual 						    CAT(1)

cat -- concatenate and print files SYNOPSIS
cat [-benstuv] [file ...] DESCRIPTION
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command-line order. If file is a single dash ('-') or absent, cat reads from the standard input. If file is a UNIX domain socket, cat connects to it and then reads it until EOF. This complements the UNIX domain binding capability available in inetd(8). The options are as follows: -b Number the non-blank output lines, starting at 1. -e Display non-printing characters (see the -v option), and display a dollar sign ('$') at the end of each line. -n Number the output lines, starting at 1. -s Squeeze multiple adjacent empty lines, causing the output to be single spaced. -t Display non-printing characters (see the -v option), and display tab characters as '^I'. -u Disable output buffering. -v Display non-printing characters so they are visible. Control characters print as '^X' for control-X; the delete character (octal 0177) prints as '^?'. Non-ASCII characters (with the high bit set) are printed as 'M-' (for meta) followed by the character for the low 7 bits. EXIT STATUS
The cat utility exits 0 on success, and >0 if an error occurs. EXAMPLES
The command: cat file1 will print the contents of file1 to the standard output. The command: cat file1 file2 > file3 will sequentially print the contents of file1 and file2 to the file file3, truncating file3 if it already exists. See the manual page for your shell (i.e., sh(1)) for more information on redirection. The command: cat file1 - file2 - file3 will print the contents of file1, print data it receives from the standard input until it receives an EOF ('^D') character, print the con- tents of file2, read and output contents of the standard input again, then finally output the contents of file3. Note that if the standard input referred to a file, the second dash on the command-line would have no effect, since the entire contents of the file would have already been read and printed by cat when it encountered the first '-' operand. SEE ALSO
head(1), more(1), pr(1), sh(1), tail(1), vis(1), zcat(1), setbuf(3) Rob Pike, "UNIX Style, or cat -v Considered Harmful", USENIX Summer Conference Proceedings, 1983. STANDARDS
The cat utility is compliant with the IEEE Std 1003.2-1992 (``POSIX.2'') specification. The flags [-benstv] are extensions to the specification. HISTORY
A cat utility appeared in Version 1 AT&T UNIX. Dennis Ritchie designed and wrote the first man page. It appears to have been cat(1). BUGS
Because of the shell language mechanism used to perform output redirection, the command ``cat file1 file2 > file1'' will cause the original data in file1 to be destroyed! The cat utility does not recognize multibyte characters when the -t or -v option is in effect. BSD
March 21, 2004 BSD

Featured Tech Videos

All times are GMT -4. The time now is 03:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy