Sponsored Content
Full Discussion: Merge files based on columns
Top Forums Shell Programming and Scripting Merge files based on columns Post 302908908 by vinus on Friday 11th of July 2014 11:53:44 AM
Old 07-11-2014
Merge files based on columns

Code:
011111123444 1234 1 20000 
011111123444 1235 1 30000
011111123446 1234 3 40000
011111123447 1234 4 50000
011111123448 1234 3 50000

File2:
Code:
011111123444,Rsttponrfgtrgtrkrfrgtrgrer
011111123446,Rsttponrfgtrgtr 
011111123447,Rsttponrfgtrguii
011111123448,Rsttponrfgtrgtjiiu

I have 2 files : File1 and File2. File1 is a fixed length file. File 2 is comma delimiter file
I want to join both files based on column 1 and append it in postion 17- 41(Max 25) on File1.
Note: If the length of column 2 of file 2 is more than 25 then trim it. Also in the output file and file 1 has one space in the begining
of each line.

Desired Output:
Code:
011111123444 Rsttponrfgtrgtrkrfrgtrgre 1234 1 20000 
011111123444 Rsttponrfgtrgtrkrfrgtrgre 1235 1 30000
011111123446 Rsttponrfgtrgtr 1234 3 20000
011111123447 Rsttponrfgtrguii 1234 4 50000
011111123448 Rsttponrfgtrgtjiiu 1234 3 50000


Can anyone please help? The input and output file postion got changed while posting , please see the attached file.

Last edited by Don Cragun; 07-11-2014 at 07:16 PM.. Reason: Add CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare two files and merge columns in a third

Hi, I'm working with snmp, with a little script I'm able to obtain from a switch a list with a couple of values with this format Port Mac 1 00:0A:0B:0C:0D:0E .... (hundred of entries) Now with a simple arp on a router I am able to obtain another list 00:0A:0B:0C:0D:0E... (20 Replies)
Discussion started by: CM64
20 Replies

2. Shell Programming and Scripting

merge the two files which has contain columns

Hi may i ask how to accomplish this task: I have 2 files which has multiple columns first file 1 a 2 b 3 c 4 d second file 14 a 9 .... 13 b 10.... 12 c 11... 11 d 12... I want to merge the second file to first file that will looks like this ... (2 Replies)
Discussion started by: jao_madn
2 Replies

3. Shell Programming and Scripting

Merge columns of different files

Hi, I have tab limited file 1 and tab limited file 2 The output should contain common first column vales and corresponding 2nd column values; AND also unique first column value with corresponding 2nd column value of the file that contains it and 0 for the second file. the output should... (10 Replies)
Discussion started by: polsum
10 Replies

4. Shell Programming and Scripting

file merge based on common columns

I have two files 1.txt 34, ABC, 7, 8, 0.9 35, CDE, 6.5, -2, 0.01 2.txt 34, ABC, 9, 6, -1.9 35, CDE, 8.5, -2.3, 5.01 So in both files common columns are 1 and 2 so final o/p should look like 34, ABC, 7, 8, 0.9, 9, 6, -1.9 35, CDE, 6.5, -2, 0.01, 8.5, -2.3, 5.01 I tried using... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

5. Shell Programming and Scripting

Merge two files matching columns

Hi! I need to merge two files when col1 (x:x:x) matching and adds second column from file1.txt. # cat 1.txt aaa;a12 bbb;b13 ccc;c33 ddd;d55 eee;e11 # cat 2.txt bbb;b55;34444;d55 aaa;a15;35666;a44 I try with this awk and I get succesfully first column from 1.txt: # awk -F";"... (2 Replies)
Discussion started by: fhluque
2 Replies

6. Shell Programming and Scripting

Merge columns on different files

Hello, I have two files that have this format: file 1 86.82 0.00 86.82 43.61 86.84 0.00 86.84 43.61 86.86 0.00 86.86 43.61 86.88 0.00 86.88 43.61 file 2 86.82 0.22 86.84 0.22 86.86 0.22 86.88 0.22 I would like to merge these two files such that the final file looks like... (5 Replies)
Discussion started by: kayak
5 Replies

7. Shell Programming and Scripting

Merge 2 files with one reference columns

Hi All Source1 servername1,patchid1 servername1,patchid2 servername1,patchid3 servername2,patchid1 servername2,patchid2 servername3,patchid4 servername3,patchid5 Source2 servername1,appname1 servername1,appname2 servername1,appname3 servername2,appname1 servername2,appname2... (13 Replies)
Discussion started by: mv_mv
13 Replies

8. Shell Programming and Scripting

Merge records based on multiple columns

Hi, I have a file with 16 columns and out of these 16 columns 14 are key columns, 15 th is order column and 16th column is having information. I need to concate the 16th column based on value of 1-14th column as key in order of 15th column. Here are the example file Input File (multiple... (3 Replies)
Discussion started by: Ravi Agrawal
3 Replies

9. Shell Programming and Scripting

Merge specific columns of two files

Hello, I have two tab delimited text files. Both files have the same number of rows but not necessarily the same number of columns. The column headers look like, File 1: f0order CVorder Name f0 RI_9 E99 E199 E299 E399 E499 E599 E699 E799 E899 E999 File 2:... (9 Replies)
Discussion started by: LMHmedchem
9 Replies

10. UNIX for Dummies Questions & Answers

Merge selective columns from files based on common key

Hi, I am trying to selectively merge two files based on keys reported in the 1st column. File1: #file1-header1 file1-header2 111 qwe rtz uio 198 asd fgh jkl 165 yxc 789 poi uzt rew 89 lkj File2: #file2-header2 file2-header2 165 ghz nko2 ... (2 Replies)
Discussion started by: dovah
2 Replies
SCANCEL(1)							 Slurm components							SCANCEL(1)

NAME
scancel - Used to signal jobs or job steps that are under the control of Slurm. SYNOPSIS
scancel [OPTIONS...] [job_id[.step_id]] [job_id[.step_id]...] DESCRIPTION
scancel is used to signal or cancel jobs or job steps. An arbitrary number of jobs or job steps may be signaled using job specification filters or a space separated list of specific job and/or job step IDs. A job or job step can only be signaled by the owner of that job or user root. If an attempt is made by an unauthorized user to signal a job or job step, an error message will be printed and the job will not be signaled. OPTIONS
-A, --account=account Restrict the scancel operation to jobs under this charge account. -b, --batch Signal the batch job shell and its child processes. This is not applicable if step_id is specified. NOTE: The shell itself may exit upon receipt of many signals. You may avoid this by explicitly trap signals within the shell script (e.g. "trap <arg> <sig- nals>"). See the shell documentation for details. --ctld Send the job signal request to the slurmctld daemon rather than directly to the slurmd daemons. This increases overhead, but offers better fault tolerance. This is the default behavior on architectures using front end nodes (e.g. BlueGene and Cray computers) or when the --clusters option is used. --help Print a help message describing all scancel options. -i, --interactive Interactive mode. Confirm each job_id.step_id before performing the cancel operation. -M, --clusters=<string> Cluster to issue commands to. -n, --name=job_name Restrict the scancel operation to jobs with this job name. -p, --partition=partition_name Restrict the scancel operation to jobs in this partition. -q, --qos=qos Restrict the scancel operation to jobs with this quality of service. -Q, --quiet Do not report an error if the specified job is already completed. This option is incompatible with the --verbose option. -R, --reservation=reservation_name Restrict the scancel operation to jobs with this reservation name. -s, --signal=signal_name The name or number of the signal to send. If no signal is specified, the specified job or step will be terminated. -t, --state=job_state_name Restrict the scancel operation to jobs in this state. job_state_name may have a value of either "PENDING", "RUNNING" or "SUSPENDED". -u, --user=user_name Restrict the scancel operation to jobs owned by this user. --usage Print a brief help message listing the scancel options. -v, --verbose Print additional logging. Multiple v's increase logging detail. This option is incompatible with the --quiet option. -V, --version Print the version number of the scancel command. -w, --nodelist=host1,host2,... Cancel any jobs using any of the given hosts. The list may be specified as a comma-separated list of hosts, a range of hosts (host[1-5,7,...] for example), or a filename. The host list will be assumed to be a filename only if it contains a "/" character. --wckey=wckey Restrict the scancel operation to jobs using this workload characterization key. ARGUMENTS job_id The Slurm job ID to be signaled. step_id The step ID of the job step to be signaled. If not specified, the operation is performed at the level of a job. If neither --batch nor --signal are used, the entire job will be terminated. When --batch is used, the batch shell processes will be signaled. The child processes of the shell will not be signalled by SLURM, but the shell may forward the signal. When --batch is not used but --signal is used, then all job steps will be signalled, but the batch script itself will not be sig- nalled. ENVIRONMENT VARIABLES
Some scancel options may be set via environment variables. These environment variables, along with their corresponding options, are listed below. (Note: commandline options will always override these settings) SCANCEL_ACCOUNT -A, --account=account SCANCEL_BATCH -b, --batch SCANCEL_CTLD --ctld SCANCEL_INTERACTIVE -i, --interactive SCANCEL_NAME -n, --name=job_name SCANCEL_PARTITION -p, --partition=partition_name SCANCEL_QOS -q, --qos=qos SCANCEL_STATE -t, --state=job_state_name SCANCEL_USER -u, --user=user_name SCANCEL_VERBOSE -v, --verbose SCANCEL_WCKEY --wckey=wckey SLURM_CONF The location of the SLURM configuration file. NOTES
If multiple filters are supplied (e.g. --partition and --name) only the jobs satisfying all of the filtering options will be signaled. Cancelling a job step will not result in the job being terminated. The job must be cancelled to release a resource allocation. To cancel a job, invoke scancel without --signal option. This will send a SIGTERM to all the job steps, wait the KillWait duration defined in the slurm.conf file, and then send a SIGKILL. This gives time for the running job/step(s) to clean up. If a signal value of "KILL" is sent to an entire job, this will cancel the active job steps but not cancel the job itself. AUTHORIZATION
When using the SLURM db, users who have AdminLevel's defined (Operator or Admin) and users who are account coordinators are given the authority to invoke scancel on other user's jobs. EXAMPLES
Send SIGTERM to steps 1 and 3 of job 1234: scancel --signal=TERM 1234.1 1234.3 Cancel job 1234 along with all of its steps: scancel 1234 Send SIGKILL to all steps of job 1235, but do not cancel the job itself: scancel --signal=KILL 1235 Send SIGUSR1 to the batch shell processes of job 1236: scancel --signal=USR1 --batch 1236 Cancel job all pending jobs belonging to user "bob" in partition "debug": scancel --state=PENDING --user=bob --partition=debug COPYING
Copyright (C) 2002-2007 The Regents of the University of California. Copyright (C) 2008-2011 Lawrence Livermore National Security. Pro- duced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE-OCEC-09-009. All rights reserved. This file is part of SLURM, a resource management program. For details, see <http://www.schedmd.com/slurmdocs/>. SLURM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. SLURM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. SEE ALSO
slurm_kill_job (3), slurm_kill_job_step (3) scancel 2.3 January 2011 SCANCEL(1)
All times are GMT -4. The time now is 12:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy