Sponsored Content
Top Forums Shell Programming and Scripting Writing out 2nd column into one file from multiple files Post 302364773 by Scott on Friday 23rd of October 2009 08:13:19 PM
Old 10-23-2009
OK, to keep it simple (and so you can easily maintain it ;-) ) based on the two input files you gave.

Code:
awk '
  /^USER/ { USER[$2] = USER[$2] " " $2; U = $2 }
  /^RUN/  { RUN[U] = RUN[U] " " $2 }
  /^WAIT/  { WAIT[U] = WAIT[U]" " $2 }
  /^DONE/  { DONE[U] = DONE [U] " " $2 }
  /^QUEUE/  { QUEUE[U] = QUEUE[U] " " $2 }
  /^TOTAL/  { TOTAL[U] = TOTAL[U] " " $2 }

  END { for ( u in USER ) {
            print "USER " USER[u]
            print "RUN " RUN[u]
            print "WAIT " WAIT[u]
            print "DONE " DONE[u]
            print "QUEUE " QUEUE[u]
            print "TOTAL " TOTAL[u]
            print ""
            }}

' file[12]


USER  bob bob
RUN  7 4
WAIT  3 5
DONE  2 5
QUEUE  long long
TOTAL  8 13

USER  maria maria
RUN  5 2
WAIT  6 4
DONE  7 3
QUEUE  short short
TOTAL  10 12


Last edited by Scott; 10-23-2009 at 09:26 PM.. Reason: why do all my uppercase U's look like lowercase u's in the top bit??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split single file into multiple files based on the number in the column

Dear All, I would like to split a file of the following format into multiple files based on the number in the 6th column (numbers 1, 2, 3...): ATOM 1 N GLY A 1 -3.198 27.537 -5.958 1.00 0.00 N ATOM 2 CA GLY A 1 -2.199 28.399 -6.617 1.00 0.00 ... (3 Replies)
Discussion started by: tomasl
3 Replies

2. UNIX for Dummies Questions & Answers

Comparing the 2nd column in two different files and printing corresponding 9th columns in new file

Dear Gurus, I am very new to UNIX. I appreciate your help to manage my files. I have 16 files with equal number of columns in it. Each file has 9 columns separated by space. I need to compare the values in the second column of first file and obtain the corresponding value in the 9th column... (12 Replies)
Discussion started by: Unilearn
12 Replies

3. Shell Programming and Scripting

comparing column of two different files and print the column from in order of 2nd file

Hi friends, My file is like: Second file is : I need to print the rows present in file one, but in order present in second file....I used while read gh;do awk ' $1=="' $gh'" {print >> FILENAME"output"} ' cat listoffirstfile done < secondfile but the output I am... (14 Replies)
Discussion started by: CAch
14 Replies

4. UNIX for Dummies Questions & Answers

Writing a loop to merge multiple files by common column

I have 100 data files labelled 250.1.txt through 250.100.txt. The second column of the data files partially match (there is about %90 overlap). Each data file has 4 columns. I want the merge all these text files by the matching values in the second column. In the output, the first column should... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

Split a file into multiple files based on line numbers and first column value

Hi All I have one query,say i have a requirement like the below code should be move to diffent files whose maximum lines can be of 10 lines.Say in the below example,it consist of 14 lines. This should be moved logically using the data in the fisrt coloumn to file1 and file 2.The data of first... (2 Replies)
Discussion started by: sarav.shan
2 Replies

6. Shell Programming and Scripting

Combining multiple column files into one with file name as first row

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

7. Shell Programming and Scripting

Difference between 2 files, one with 1 column and 2nd file with multiple columns

Hi, I need to find the difference between 2 files in unix and write the result in the new file File1: A B File2: X 123 hajkd Y 345 adjfka A 123 djafjhd B 678 dsndjks Output file: X 123 hajkd Y 345 adjfka Thanks. (6 Replies)
Discussion started by: nani1984
6 Replies

8. Shell Programming and Scripting

Join 2nd column of multiple files

Dear All, I have many files formatted like this: file1.txt: 1/2-SBSRNA4 18 A1BG 3 A1BG-AS1 6 A1CF 0 A2LD1 1 A2M 1160 file2.txt 1/2-SBSRNA4 53 A1BG 1 A1BG-AS1 7 A1CF 0 A2LD1 3 A2M 2780 (5 Replies)
Discussion started by: paolo.kunder
5 Replies

9. Shell Programming and Scripting

Locate the files in the first column and copy the files in 2nd column

#cat data.txt file1 folder1 file2 thisforfile2 file3 thisfolderforfile3 lata4 folder4 step 1: create the folder first in column 2 for i in `awk '{print $2}' data.txt` do mkdir /home/data/$i done step 2: locate the files in column1 and stored them into a file for i in... (17 Replies)
Discussion started by: kenshinhimura
17 Replies

10. UNIX for Beginners Questions & Answers

How to copy a column of multiple files and paste into new excel file (next to column)?

I have data of an excel files as given below, file1 org1_1 1 1 2.5 100 org1_2 1 2 5.5 98 org1_3 1 3 7.2 88 file2 org2_1 1 1 2.5 100 org2_2 1 2 5.5 56 org2_3 1 3 7.2 70 I have multiple excel files as above shown. I have to copy column 1, column 4 and paste into a new excel file as... (26 Replies)
Discussion started by: dineshkumarsrk
26 Replies
GLOBUS-JOB-RUN(1)						  GRAM5 Commands						 GLOBUS-JOB-RUN(1)

NAME
globus-job-run - Execute a job using GRAM SYNOPSIS
globus-job-run [-dumprsl] [-dryrun] [-verify] [-file ARGUMENT_FILE] SERVICE_CONTACT [-np PROCESSES | -count PROCESSES] [-m MAX_TIME | -maxtime MAX_TIME] [-p PROJECT | -project PROJECT] [-q QUEUE | -queue QUEUE] [-d DIRECTORY | -directory DIRECTORY] [-env NAME=VALUE]... [-stdin [-l | -s] STDIN_FILE] [-stdout [-l | -s] STDOUT_FILE] [-stderr [-l | -s] STDERR_FILE] [-x RSL_CLAUSE] [-l | -s] EXECUTABLE [ARGUMENT...] globus-job-run [-help] [-usage] [-version] [-versions] DESCRIPTION
The globus-job-run program constructs a job description from its command-line options and then submits the job to the GRAM service running at SERVICE_CONTACT. The executable and arguments to the executable are provided on the command-line after all other options. Note that the -dumprsl, -dryrun, -verify, and -file command-line options must occur before the first non-option argument, the SERVICE_CONTACT. The globus-job-run provides similar functionality to globusrun in that it allows interactive start-up of GRAM jobs. However, unlike globusrun, it uses command-line parameters to define the job instead of RSL expressions. OPTIONS
The full set of options to globus-job-run are: -help, -usage Display a help message to standard error and exit. -version Display the software version of the globus-job-run program to standard output. -version Display the software version of the globus-job-run program including DiRT information to standard output. -dumprsl Translate the command-line options to globus-job-run into an RSL expression that can be used with tools such as globusrun. -dryrun Submit the job request to the GRAM service with the dryrun option enabled. When this option is used, the GRAM service prepares to execute the job but stops before submitting the job to the LRM. This can be used to diagnose some problems such as missing files. -verify Submit the job request to the GRAM service with the dryrun option enabled and then without it enabled if the dryrun is successful. -file ARGUMENT_FILE Read additional command-line options from ARGUMENT_FILE. -np PROCESSES, -count PROCESSES Start PROCESSES instances of the executable as a single job. -m MAX_TIME, -maxtime MAX_TIME Schedule the job to run for a maximum of MAX_TIME minutes. -p PROJECT, -project PROJECT Request that the job use the allocation PROJECT when submitting the job to the LRM. -q QUEUE, -queue QUEUE Request that the job be submitted to the LRM using the named QUEUE. -d DIRECTORY, -directory DIRECTORY Run the job in the directory named by DIRECTORY. Input and output files will be interpreted relative to this directory. This directory must exist on the file system on the LRM-managed resource. If not specified, the job will run in the home directory of the user the job is running as. -env NAME=VALUE Define an environment variable named by NAME with the value VALUE in the job environment. This option may be specified multiple times to define multiple environment variables. -stdin [-l | -s] STDIN_FILE Use the file named by STDIN_FILE as the standard input of the job. If the -l option is specified, then this file is interpreted to be on a file system local to the LRM. If the -s option is specified, then this file is interpreted to be on the file system where globus-job-run is being executed, and the file will be staged via GASS. If neither is specified, the local behavior is assumed. -stdout [-l | -s] STDOUT_FILE Use the file named by STDOUT_FILE as the destination for the standard output of the job. If the -l option is specified, then this file is interpreted to be on a file system local to the LRM. If the -s option is specified, then this file is interpreted to be on the file system where globus-job-run is being executed, and the file will be staged via GASS. If neither is specified, the local behavior is assumed. -stderr [-l | -s] STDERR_FILE Use the file named by STDERR_FILE as the destination for the standard error of the job. If the -l option is specified, then this file is interpreted to be on a file system local to the LRM. If the -s option is specified, then this file is interpreted to be on the file system where globus-job-run is being executed, and the file will be staged via GASS. If neither is specified, the local behavior is assumed. -x RSL_CLAUSE Add a set of custom RSL attributes described by RSL_CLAUSE to the job description. The clause must be an RSL conjunction and may contain one or more attributes. This can be used to include attributes which can not be defined by other command-line options of globus-job-run. -l When included outside the context of -stdin, -stdout, or -stderr command-line options, -l option alters the interpretation of the executable path. If the -l option is specified, then the executable is interpreted to be on a file system local to the LRM. -s When included outside the context of -stdin, -stdout, or -stderr command-line options, -l option alters the interpretation of the executable path. If the -s option is specified, then the executable is interpreted to be on the file system where globus-job-run is being executed, and the file will be staged via GASS. If neither is specified, the local behavior is assumed. ENVIRONMENT
If the following variables affect the execution of globus-job-run. X509_USER_PROXY Path to proxy credential. X509_CERT_DIR Path to trusted certificate directory. SEE ALSO
globusrun(1), globus-job-submit(1), globus-job-clean(1), globus-job-get-output(1), globus-job-cancel(1) University of Chicago 03/18/2010 GLOBUS-JOB-RUN(1)
All times are GMT -4. The time now is 10:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy