Sponsored Content
Full Discussion: Add column to a file
Top Forums Shell Programming and Scripting Add column to a file Post 302562198 by drl on Thursday 6th of October 2011 09:49:43 AM
Old 10-06-2011
Hi.
Quote:
To obtain the best answers quickly when you want help in
processing datasets -- extracting, transforming, filtering,
you should:

1. Post representative samples of your data (i.e. data that
should "succeed" and data that should "fail")

2. Post what you expect the results to be, instead of trying
only to describe them. Be clear about how the results are to be
obtained, e.g. "add field 2 in file1 to field 3 from file2"

3. Post what you have attempted to do so far.

4. Place the data and expected output within CODE tags, so that
they are more easily readable.

Special cases, exceptions, etc., are very important to include
in the samples.
cheers, drl
This User Gave Thanks to drl For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to add a new column in an existing file

Hi guys, Please help me if u have some solution. I have a file with three columns separated by ':' - INPUT_FILE C416722_2 : calin Dirigent : Dirigent AC4174_6 : Jac : cal_co TC4260_5 : [no : lin kite BC426302_1 : [no : calin Dirigent lin JC426540_3 : lin Pymo_bin : calin TC428_3 : no7... (4 Replies)
Discussion started by: sam_2921
4 Replies

2. Shell Programming and Scripting

How to add a particular column alone in a file

Hi I have file which contains 5 coulmns i need to add the fifth column value and put it in the desired location in the same column. Here is the sample file.. ashop0004 SQL- 06/14/2009 06/14/2009 00:04:28 SUM ashop0004 SQL- 06/14/2009 06/14/2009 00:00:37 ... (22 Replies)
Discussion started by: cutechaps
22 Replies

3. Shell Programming and Scripting

Need to add letters to a column and add in a new column subtracting from another column

So I have this input 1 10327 rs112750067 T C . PASS DP=65;AF=0.208;CB=BC,NCBI 1 10469 rs117577454 C G . PASS DP=2055;AF=0.020;CB=UM,BC,NCBI 1 10492 rs55998931 C T . PASS DP=231;AF=0.167;CB=BC,NCBI 1 10583 rs58108140 G A ... (3 Replies)
Discussion started by: kellywilliams
3 Replies

4. Shell Programming and Scripting

Add column info from one file to larger second file

Hi, long time reader, first time poster. I've done some searching so please if this is a repeated post excuse the duplicate, but what I have are two files roughly like so: File 1: A W B X C Y D Z File 2: A 1 C 2 D 3 And what I would like to get out is... (4 Replies)
Discussion started by: wallysb01
4 Replies

5. Shell Programming and Scripting

How to add a column from other file?

Dear all, Lets say, I've a file a.txt containing two columns, like a1 b1 .. .. .. .. and another file b.txt containg two columns, like a1 c1 .. .. .. .. I need to put c1 column from b.txt file to the a.txt file. So, the output should be a1 b1 c1 .. .. .. .. ... (4 Replies)
Discussion started by: mkg
4 Replies

6. Shell Programming and Scripting

Help with add existing file name as new data column in new output file

Input File 1 cat S1.txt MI0043 2731 miR-1 Input File 2 cat S4.txt MI006 310 CiR-1 MI057 10 CiR-24 MI750 5 CiR-24 Desired Output File 1 cat S1.txt.out MI0043 2731 miR-1 S1.txt Desired Output File 2 cat S4.txt.out MI006 310 CiR-1 S4.txt (3 Replies)
Discussion started by: perl_beginner
3 Replies

7. Shell Programming and Scripting

Add a new column to file

I have file like this b,c 10,20 30,40 50,60 Now I want to add a new column a with fixed values for all the rows a,b,c 60,10,20 60,30,40 60,50,60 Please let me know how can we do this in unix. (4 Replies)
Discussion started by: weknowd
4 Replies

8. UNIX for Dummies Questions & Answers

Add a column to a file

Hi, I have this data file that contains: 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I I want the results to be: 1 A A 2 B A 3 C A 4 D A 5 E A 6 F A 7 G A 8 H A (8 Replies)
Discussion started by: bobo
8 Replies

9. Shell Programming and Scripting

Add new column in the file

Hi Team I have file as below empno,ename,sal 123,smith,1000 124,adams,2000 Required output: Using AWK empno,ename,sal,deptno 123,smith,1000 124,adams,2000 Thanks, Murali (5 Replies)
Discussion started by: bmk
5 Replies

10. UNIX for Beginners Questions & Answers

Add new column from another file

Hi, I have 2 files. file1 contains by lines: hash:salt:id file2 contains by lines: username:hash:salt I would like to add a new coloumn (id) form file1 to file2. The new file should contains: username:hash:salt:id Note: file1 contains less rows than file2. I tried paste -d':' file1... (12 Replies)
Discussion started by: freeroute
12 Replies
PERF-DIFF(1)							    perf Manual 						      PERF-DIFF(1)

NAME
perf-diff - Read perf.data files and display the differential profile SYNOPSIS
perf diff [baseline file] [data file1] [[data file2] ... ] DESCRIPTION
This command displays the performance difference amongst two or more perf.data files captured via perf record. If no parameters are passed it will assume perf.data.old and perf.data. The differential profile is displayed only for events matching both specified perf.data files. OPTIONS
-D, --dump-raw-trace Dump raw trace in ASCII. -m, --modules Load module symbols. WARNING: use only with -k and LIVE kernel -d, --dsos= Only consider symbols in these dsos. CSV that understands file://filename entries. -C, --comms= Only consider symbols in these comms. CSV that understands file://filename entries. -S, --symbols= Only consider these symbols. CSV that understands file://filename entries. -s, --sort= Sort by key(s): pid, comm, dso, symbol. -t, --field-separator= Use a special separator character and don't pad with spaces, replacing all occurrences of this separator in symbol names (and other output) with a . character, that thus it's the only non valid separator. -v, --verbose Be verbose, for instance, show the raw counts in addition to the diff. -f, --force Don't complain, do it. --symfs=<directory> Look for files with symbols relative to this directory. -b, --baseline-only Show only items with match in baseline. -c, --compute Differential computation selection - delta,ratio,wdiff (default is delta). See COMPARISON METHODS section for more info. -p, --period Show period values for both compared hist entries. -F, --formula Show formula for given computation. -o, --order Specify compute sorting column number. COMPARISON
The comparison is governed by the baseline file. The baseline perf.data file is iterated for samples. All other perf.data files specified on the command line are searched for the baseline sample pair. If the pair is found, specified computation is made and result is displayed. All samples from non-baseline perf.data files, that do not match any baseline entry, are displayed with empty space within baseline column and possible computation results (delta) in their related column. Example files samples: - file A with samples f1, f2, f3, f4, f6 - file B with samples f2, f4, f5 - file C with samples f1, f2, f5 Example output: x - computation takes place for pair b - baseline sample percentage o perf diff A B C baseline/A compute/B compute/C samples --------------------------------------- b x f1 b x x f2 b f3 b x f4 b f6 x x f5 o perf diff B A C baseline/B compute/A compute/C samples --------------------------------------- b x x f2 b x f4 b x f5 x x f1 x f3 x f6 o perf diff C B A baseline/C compute/B compute/A samples --------------------------------------- b x f1 b x x f2 b x f5 x f3 x x f4 x f6 COMPARISON METHODS
delta If specified the Delta column is displayed with value d computed as: d = A->period_percent - B->period_percent with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period_percent being the % of the hist entry period value within single data file ratio If specified the Ratio column is displayed with value r computed as: r = A->period / B->period with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period being the hist entry period value wdiff:WEIGHT-B,WEIGHT-A If specified the Weighted diff column is displayed with value d computed as: d = B->period * WEIGHT-A - A->period * WEIGHT-B o A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period being the hist entry period value o WEIGHT-A/WEIGHT-B being user suplied weights in the the -c option behind : separator like -c wdiff:1,2. o WIEGHT-A being the weight of the data file o WIEGHT-B being the weight of the baseline data file SEE ALSO
perf-record(1) perf 06/30/2014 PERF-DIFF(1)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy