08-22-2017
Appending multiple files through UNIX
Hi All,
I have requirement where multiple csv files are present in a directory and each file contains a header.I need to append the contents of all the files into one file by removing header.
Once the data is merged in one file ,I need to remove duplicates on nth column to find out distinct record on the merged file.Can anyone please help me with this through unix scripting.Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a string that I need to append to 3 files.
Say,
$ echo "Hello"
I want to append this “Hello” to three files, file1, file2 and file3.The files are all in different directories and the file names have no common pattern.Can I do it in one line? If yes, how? :confused: (2 Replies)
Discussion started by: zombiezparadize
2 Replies
2. Shell Programming and Scripting
Hello,
I have a some files that look like this:
0 3
1 5
2 8
3 7
I want to reverse and append the data so it looks like this:
3 7
2 8
1 5
0 3
0 3
1 5
2 8
3 7
I first thought about using cat and tac cleverly with some redirection and pipe in a one-liner but I couldn't get it to... (1 Reply)
Discussion started by: bigfoot
1 Replies
3. UNIX for Dummies Questions & Answers
Hello,
There is a log file A.log where new lines are getting added every minute.
When ever any new lines are getting added in to A , the same lines needs to be appended to B.log
I need to append these newly added lines to end of another file B through a shell script. I tried CAT but its... (2 Replies)
Discussion started by: twisterboy
2 Replies
4. Shell Programming and Scripting
Dear All,
I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File.
The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files.
Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies
5. Shell Programming and Scripting
Hi
I have an ssh 'for' loop script to login and put a key on multiple servers. I need to append a file on each server but the command which works ok from the prompt does not work via the script. I have
cat filename | ssh user@servername "cat >>append.file.name"
I have tried to 'spawn' this in... (0 Replies)
Discussion started by: Grueben
0 Replies
6. UNIX for Dummies Questions & Answers
I am trying to append multiple files in a directory
cat /a/file1.txt /a/file2.txt /a/file3.txt /a/file4.txt > /a/file.txt
Except file2 every other file is appending.
I interchanged file names and ran the command. Whatever file repeating in the second position is missing in output... (6 Replies)
Discussion started by: eskay
6 Replies
7. Shell Programming and Scripting
Hi,
I have multiple files that read:
Asa.txt
Bad.txt
Gnu.txt
And I want to rename them using awk to
Asa_ddmmyytt.txt and so on
...
If there is a single command or more efficient executable please share!
Thanks! (4 Replies)
Discussion started by: Jesshelle David
4 Replies
8. UNIX for Beginners Questions & Answers
Hi All,
I am trying to append time stamp to all file with wild character.
If you look above I want take all file with wild card *001* and append current time stamp to it.
I did below code. But not sure if there is any easy way that can be done in a single step
a=date +%s
for... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
9. Shell Programming and Scripting
Hello All,
I have three input files
cat file1
col1|col2|col3
a|1|A
b|2|B
cat file2
col1|col2|col3
c|3|C
cat file3
col1|col2|col3
d|4|D
e|5|E
i want below output
file4 col1|col2
a|1 (6 Replies)
Discussion started by: looney
6 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table.
Can you please suggest why? or any better idea?
export FILE="/abc/autom/file/geo_JOB.csv"
Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies
LEARN ABOUT DEBIAN
minmax
MINMAX(l) MINMAX(l)
NAME
minmax - Find extreme values in data tables
SYNOPSIS
minmax [ files] [ -C ] [ -D ] [ -H[nrec] ] [ -Idx[/dy] ] [ -L ] [ -M[flag] ] [ -: ] [ -bi[s][n] ]
DESCRIPTION
minmax reads its standard input [or from files] and finds the extreme values in each of the columns. It recognizes NaNs and will print
warnings if the number of columns vary from record to record. As an option, minmax will find the extent of the first two columns rounded
up and down to the nearest multiple of dx/dy. This output will be in the form -Rw/e/s/n which can be used directly in the command line for
other programs, or simply in column form.
xyzfile
ASCII [or binary, see -b] file(s) holding a fixed number of data columns.
OPTIONS
-C Report the min/max values per column in separate columns [Default uses <min/max> format]
-D Sets longitude discontinuity to the Dateline (-180/+180) [Default is Greenwich (0-360)]. Requires -L.
-H Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults file. If used, GMT default
is 1 header record.
-I Report the min/max of the first two columns to the nearest multiple of dx and dy, and output this in the form -Rw/e/s/n (unless -C
is set).
-L Indicates that the x column contains longitudes, which may be periodic in 360 degrees [Default assumes no periodicity].
-M Multiple segment file(s). Segments are separated by a special record. For ASCII files the first character must be flag [Default is
'>']. For binary files all fields must be NaN.
-: Toggles between (longitude,latitude) and (latitude,longitude) input/output. [Default is (longitude,latitude)]. Applies to geo-
graphic coordinates only. Only works when -I is selected.
-bi Selects binary input. Append s for single precision [Default is double]. Append n for the number of columns in the binary file(s).
[Default is 2 input columns].
EXAMPLES
To find the extreme values in the file ship_gravity.xygd, try
minmax ship_gravity.xygd
Output should look like
ship_gravity.xygd: N = 6992 <326.125/334.684> <-28.0711/-8.6837> <-47.7/177.6> <0.6/3544.9>
To find the extreme values in the file track.xy to the nearest 5 units and use this region to draw a line using psxy, try
psxy `minmax -I5 track.xy` track.xy -Jx1 -B5 -P > track.ps
To find the min and max values for each column, but rounded to integers, try
minmax junkfile -C -I1
SEE ALSO
gmt(1gmt)
1 Jan 2004 MINMAX(l)