Sponsored Content
Top Forums Shell Programming and Scripting Merging Files in UNIX shell script Post 302769589 by Corona688 on Tuesday 12th of February 2013 05:46:31 PM
Old 02-12-2013
Code:
ls | awk -F- '{ print $1 }' | sort -u | while read X
do
      echo cat $X-HDR-* $X-BODY-* $X-FTR-*
done

See if this finds the files you wanted. It should print "1-HDR-whatever 1-BODY-whatever 1-FTR-whatever".

If it's assembling them in the right order, change that line to this one to do the job for real:

Code:
 cat $X-HDR-* $X-BODY-* $X-FTR-* > output-$X.txt

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to delete files in UNIX using shell script

Hi, I have the following task to perform using shell script. The user will provide a directory name along with a date. The script will delete all the files in the specified directory that was created earlier to that date. Also it should display the number of files that has been deleted. ... (7 Replies)
Discussion started by: theguy16
7 Replies

2. UNIX for Dummies Questions & Answers

Merging 2 .CSV files in Unix

I need a little help as I am a complete novice at scripting in unix. However, i am posed with an issue...:eek: i have two csv files in the following format@ FILE1.CSV: HEADER HEADER Header , , HEADER 001X ,,200 002X ,,300 003X ... (6 Replies)
Discussion started by: chachabronson
6 Replies

3. Shell Programming and Scripting

merging of 2 files AWK, SHELL or something else

I have 2 files pipe delimted and want to merge them based on a key e.g file 1 123|xxx|yyy|zzz 345|xab|yzy|zyz 456|sss|ttt|foo file 2 123|hhh|ggg|xxx 345|ddd|www|ddd|fff 456|ddd|sss|sss|eee so if the key is the first field, and the result should be file 1 with field 2 from file 2... (24 Replies)
Discussion started by: klut
24 Replies

4. Shell Programming and Scripting

Shell script for merging lines in a loop

Dear All, I need a script to merge lines of an input file in a loop, please guide me for the script or one liner(awk, sed, tr, shell, perl). I/P File------------------------- APaul,,,,SDH,,23,,,PPH,,2 ,,,,KKH,,19,,,MMH,,12, ,,,,CCH,,22,,,MNH,,19, ,,,,TCH,,55,,,NNH,,67,... (3 Replies)
Discussion started by: ashis.tewari
3 Replies

5. Shell Programming and Scripting

Script for merging files

I am facing a strange situation where I need to collect logs and consolidate them. All logs are under say /tmp/useless and all logs are under subdir of the form IPaddresses_x_y eg: /tmp/useless/105.52.34.246_3_1 /tmp/useless/105.52.1.118_0_10 There are several logs under each... (2 Replies)
Discussion started by: zpn
2 Replies

6. Shell Programming and Scripting

AWK Script For Merging Text Files

Hello, I am trying to merge data from two text files. One file (File1) contains a listing of data which includes the trial number in Column 5, while the other text file (File2) contains what category the trial belongs to. Here is a snippet of what File1 looks like. 1 Arrow_ST 9.738 0.905... (2 Replies)
Discussion started by: Jahn
2 Replies

7. Shell Programming and Scripting

Script for merging six files into one

Hi all Need little help from you my aim is like merging the output of 6 files (log_files) And merge it into the one master file tell me the script for this please thanks in advance Please reply in mail if possible <email removed> Regards: zimmy (1 Reply)
Discussion started by: zimmyyash
1 Replies

8. Shell Programming and Scripting

Merging Very large CSV files in Unix

Hi, I have two very large CSV files, which I want to merge (equi-join) based on a key (column). One of the file (say F1) would have ~30 MM records and 700 columns. The other file (~f2) would have same # of records and lesser columns (say 50). I want to create an output file joining on a... (3 Replies)
Discussion started by: student_007
3 Replies

9. Shell Programming and Scripting

Merging two files in UNIX

Hi Experts, Need urgent solution for a problem. I have two files file1 and file2. file1 is tab separated and file2 is comma separated. I need to merge both the files into single file based on CUST_ID by retaining the headers of file1 Matching CUST_IDs should be placed one below the other in... (11 Replies)
Discussion started by: bharathbangalor
11 Replies

10. Shell Programming and Scripting

Help getting a UNIX shell script to look at multiple files.

Hey everyone! I made a shell script that would go through a file and replace any phrase or letter with another phrase or letter. Helps update variable names or values. The following code is this: #!/bin/sh Word1="$1" Replace1="$2" File1="$3" arg=$( echo "$Word1" | sed 's:\:\\&:g' )... (3 Replies)
Discussion started by: rebmonk
3 Replies
pfsinpfm(1)						      General Commands Manual						       pfsinpfm(1)

NAME
pfsinpfm - Load images or frames in PFM format SYNOPSIS
pfsinpfm (<file> [--frames <range>] [--skip-missing]) [<file>...] DESCRIPTION
Use this command to read frames in PFM format. PFM format is used for HDR Shop plug-ins and is also supported by some recent versions of NetPBM package (pamtopfm and pfmtopam commands). The frames are converted to pfs stream and send to the Standard Output. This command can handle both color and gray-scale images. Details on the format of the pattern file names, which are used for reading multiple frames, can be found in the manual page of pfsinppm. To automatically recognize a file format from the extension, use pfsin command instead. EXAMPLES
pfsin memorial.pfm | pfsout memorial.hdr Converts from one HDR format to another BUGS
pfsinpfm does not handle images that store floating point numbers using big-endian format. pfsoutpfm may also read floating point numbers incorrectly on big-endian machines. Please report bugs and comments on implementation to the discussion group http://groups.google.com/group/pfstools SEE ALSO
pfsin(1) pfsinppm(1) pfsoutpfm(1) pfsinpfm(1)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy