06-02-2011
Combining columns from multiple files to one file
I'm trying to combine colums from multiple file to a single file but having some issues, appreciate your help.
The filenames are the same except for the extension,
path1.m0
---------
a b c
d e f
g h i
path1.m1
---------
m n o
p q r
s t u
File names are path1.m[0 - 1]
The desired output file is path1.m and output is
a n
d q
g t
I can do this by the paste command
paste path1.m0 path1.m1 | awk '{print $1 $5}' > path1.m
The issue I'm having is that I've multiple files like
path2.m0
path2.m1
path3.m0
path4.m1
How do I set a variable to read all the path1.* and path2.* and path3* files and give the output files
path1.m
path2.m
path3.m
Thanks very much.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I would be very grateful for some advice on the following.
I have several text files. The files are experiment results with columns of data separated by white space.
The files begin with several lines of header which are all preceeded by a comment character '#'.
Each file has a... (10 Replies)
Discussion started by: iomaire
10 Replies
2. Shell Programming and Scripting
I have two files I need to combine. The problem I'm having is I need to only combine data from the second file in the empty spaces of the first. For example:
file1
Data Field
Data Field
Data Field
Data Field
file2
a - Insert Data
b - Insert Data
c - Insert Data
d - Insert Data... (10 Replies)
Discussion started by: handband2
10 Replies
3. UNIX for Dummies Questions & Answers
I have one space delimited file with multiple columns and one tab delimited file with multiple columns (They have the same number of rows). I want to basically combine these two text files into a new text file by column. How would I go about doing that? (1 Reply)
Discussion started by: evelibertine
1 Replies
4. Shell Programming and Scripting
Hello All,
I have several column files like this
$cat a_b_s1.xls
1wert
2tg
3asd
4asdf
5asdf
$cat c_d_s2.xls
1wert
2tg
3asd
4asdf
5asdf
desired put put
$cat combined.txt
s1 s2 (2 Replies)
Discussion started by: avatar_007
2 Replies
5. Shell Programming and Scripting
I have 2 files.
each having 3 coloums
1st field date as 20130322
2nd field time as 05:55
3rd field numberic value
File 2 has entries missing for some date time.
FILE1
20130322 05:35 2219
20130322 05:40 1809
20130322 05:45 1617
20130322 05:50 ... (2 Replies)
Discussion started by: sandeepkmehra
2 Replies
6. Shell Programming and Scripting
Hi,
I have 3 files with one column value as shown
File: a.txt
------------
Data_a1
Data_a2
File2: b.txt
------------
Data_b1
Data_b2
Data_b3
Data_b4
File3: c.txt
------------
Data_c1
Data_c2
Data_c3
Data_c4
Data_c5 (6 Replies)
Discussion started by: vfrg
6 Replies
7. Linux
Hey Guys & Gals,
I am stuck with the following ;
I have 2 text files, each containing 2 columns.
My goal is to have a column from the 2nd file placed inbetween the columns in the first file.
Basically the idea is, each address has a different name (but 1 name per address) but 1 address... (6 Replies)
Discussion started by: TAPE
6 Replies
8. Shell Programming and Scripting
I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns.
Like I have file A
1234,ABCD,23,JOHN,NJ,USA
2345,ABCD,24,SAM,NY,USA
5678,GHIJ,24,TOM,NY,USA
5678,WXYZ,27,MAT,NJ,USA
and file B
... (2 Replies)
Discussion started by: mady135
2 Replies
9. UNIX for Beginners Questions & Answers
Hello Everyone,
I have 4 different files (one column in each) that I'm trying to combine into 1 file with four columns. Having issues trying to get the columns to format properly. I have tried the following:
paste file1 file2 file3 file4 | column -s $'\t' -t > results.txt
paste file1 file2... (1 Reply)
Discussion started by: malk71
1 Replies
10. Shell Programming and Scripting
Hello Unix gurus,
I have a large number of files (say X) each containing two columns of data and the same number of rows.
I would like to combine these files to create a unique merged file containing X columns corresponding to the second column of each file (with a bonus of having the first... (3 Replies)
Discussion started by: ksennin
3 Replies
LEARN ABOUT DEBIAN
dh_cligacpolicy
DH_CLIGACPOLICY(1) Debhelper for CLI (Common Language Infrastructure) DH_CLIGACPOLICY(1)
NAME
dh_cligacpolicy - creates and installs a CLI policy file for a package
SYNOPSIS
dh_cligacpolicy [debhelper options] [-n]
DESCRIPTION
dh_cligacpolicy is a debhelper program that is responsible for creating, compiling, and installing policy files for a Debian package. This
automatically includes postinst and prerm commands needed to install these policies into the system.
OPTIONS
-n, --noscripts
Do not modify postinst/prerm scripts.
FILE FORMAT
This file uses the debian/cligacpolicy files (either policyassemblies or debian/packagename.cligacpolicy) to generate the policy file. It
supports multiple versions of the policy, including mapping multiple versions to a single file.
The file format of the cligacpolicy file consists of five properties per line, each one separated by whitespace.
Keyfile is a path, from the package root, to the .snk file =used to sign the assembly.
Assembly is the name of the assembly, without the .dll =extension. For example, for log4net.dll, use log4net.
Version Range can be a single four-part version, such as =1.2.3.4, or a full range, such as 1.2.3.4-1.2.6.7. For a single line, =the first
two numbers must be identical. To have an assembly apply to =multiple versions, such as 1.2.0.0 to 2.4.0.0, there needs to be one =line for
each version range.
Assembly version is the version of the assembly being =built.
Priority defines the priority of the policy files. =Typically, each version will increase the priority and =contains all the policy
controls for prior versions.
The fields can be separated with spaces or tabs. Comments start the line with # characters and blank lines are ignored.
NOTES
Note that this command is not idempotent. "dh_clean -k" should be called between invocations of this command. Otherwise, it may cause
multiple instances of the same text to be added to maintainer scripts.
EXAMPLE
For the log4net 1.2.10.0 version, a policy file is used to map all versions from 1.2.8.0 to 1.2.9.99 into the current version.
debian/log4net.snk log4net 1.2.8.0-1.2.9.99 1.2.10.0 10
SEE ALSO
debhelper(7)
This program is a part of cli-common-dev.
AUTHOR
Dylan R. E. Moonfire <debian@mfgames.com>
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 31:
You forgot a '=back' before '=head1'
perl v5.14.2 2012-01-17 DH_CLIGACPOLICY(1)