The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
3answers
60 views

How can I use a triple slash as a delimiter with cut?

I have a table in which each entry looks something like, coagulation factor VIII-associated 1 /// coagulation factor VIII-associated 2 /// coagulation factor VIII-associated 3 I would like to use ...
6
votes
4answers
71 views

True column deletion, not selecting all columns that you want

I know this is a simple question and in many ways has been answered before, however every use I've seen of awk, sed, grep etc have all been selecting and printing the columns you want. In a case where ...
1
vote
4answers
36 views

cut column 2 from text file

My text file has no delimiter to specify separator just spaces, how do I cut out column 2 to output file, 39 207 City and County of San Francisc REJECTED MAT = 0 78 412 Cases and ...
2
votes
1answer
37 views

How to standardize the number of characters in a column?

I have a column (in my data-file database) where the number of characters is not standardized, and need to standardize. How can I do it? Example: Sample_ID 159 148 1110 1100 150 But my bank does ...
1
vote
1answer
18 views

Awk problem: an 'if column conditional' replaces the column entry!

I'm trying to get a grip on awk. Suppose I have an input: this header fred blah 1 blank fred blah 1 blank huh blah 2 blank fred blah 3 blank fred blah 3 blank and after I use the following awk ...
3
votes
1answer
48 views

Combining every two column values in file

I have a file with (with only one line) with multiple columns say 4 (in this case) : A B C D And I want the output as every possible combination of column values taking 2 at a time like: AB AC AD ...
2
votes
2answers
34 views

average of specific rows in a file and output in tab-delimited file

I have 6 rows in files. I need to find average only of specific rows in a file and the others should be left as they are. The average should be calculated for A1 and A2, B1 and B2, other lines should ...
0
votes
2answers
72 views

Compare a file with a column of another file

I have a file File1 with data as aaa bbb And another file File2 with data as: 2,aaa,234 w,bbb,589 4,ccc,675 I need to compare the File1 data with column2 data of File2 and print the matching ...
0
votes
1answer
32 views

How to replace word in specific column if it does not match an expression?

I have the following file: chr1 157784 157887 U6 0 - chr1 564813 564881 miRNA 0 + chr1 564879 564950 tRNA 0 - chr1 564952 565019 tRNA 0 + chr1 566062 566129 ...
1
vote
2answers
44 views

Align command output in columns

I have the following output of my script: panos@panos:~/scripts> ./list_packages openSUSE-2016-254 zypper-aptitude.noarch : 1.12.23-1.1 update needed zypper-log.noarch : 1.12.23-1.1 update needed ...
1
vote
2answers
55 views

awk is putting last column in a new line

I have this -77.199997 23.6343749630 39.9989584580 -80.000000 23.6364583430 39.9989584580 -81.599998 23.6385417220 39.9989584580 I want to reorder the columns so it reads column 2, ...
4
votes
2answers
126 views

Issue with column command and color escape codes

I'm colorizing the header of a table formatted with column -ts $'\t' Works well without color codes, but when I add color codes to the first line column doesn't properly align the output. Without ...
1
vote
1answer
41 views

Matching 2 main columns between files; and paste other columns into the output file when those main columns match. Keep row size of 1st file intact

This is a follow-up question to my previous question asked about 24 hours ago. Link to previous question: Previous Question Link G-Man solved that problem with a useful code, but I have a follow-up ...
0
votes
1answer
44 views

Sum values from column 1 if column 2 rows have a value match

I have data in a .txt like this: 2 40 1 50 1 50 1 50 1 50 2 70 2 70 5 80 5 80 6 100 And I want to sum first column if the second column's rows match so I can get an output like ...
2
votes
1answer
92 views

Matching two main columns at the same time between files, and paste supplementary columns into the output file when those main columns match

I have 3 files, each with a unique number of columns, all tab-separated, but some columns are shared between the 3 files. It's the shared columns between the 3 files that I want to use to create some ...
1
vote
3answers
50 views

combine selected column multi file

I have multiple files (~15), each with multi column data (tab seperated). For example: File1 aa1 399 1815 aa2 1908 4064 aa3 4523 5656 File2 bb1 5304317 5305057 bb2 ...
0
votes
1answer
15 views

Merge records depending on first three common columns and place the values which are uncommon in the last column as comma separated [duplicate]

Merge records depending on first three common columns and place the values which are uncommon in the last column as comma separated . I have a requirement to do the following- InputFile : HWF ...
1
vote
1answer
54 views

Merge records depending on common columns and specify the values which are uncommon in the last column as comma separated

I need to merge records depending on first three common columns and place the values which are uncommon in the last column as comma separated . I have a requirement to do the following- InputFile : ...
1
vote
1answer
55 views

Comapring columns in 2 files and printing the values that differ

I have a file (file-1) that looks like this, DIP-10097N|refseq:NP_416170|uniprotkb:P30015 DIP-10117N|refseq:NP_414973|uniprotkb:P08177 DIP-10168N|refseq:NP_418766|uniprotkb:P15005 DIP-10199N|refseq:...
2
votes
3answers
109 views

Replace a column and preserve spacing

This is a follow up to unix: replace one entire column in one file with a single value from another file I am trying to replace one column of a file (file1) with one specific value from another file (...
1
vote
5answers
50 views

split the content of a specific column

I need to split the content of the second column of my file into 2 columns, for example: Id allele id2 30 TC 12 211 GG 12 327 AA 13 688 TC 15 760 TT 18 868 CC ...
3
votes
3answers
148 views

How do I create uniform columns from text containing both tabs and spaces?

In the simplest form, let's say I have an auto-generated file called file.txt. The contents of file.txt appears as follows: Source Destination Maximum To Maximum ...
6
votes
4answers
444 views

Delete column that includes a specific text

I was looking for an option to delete a column with a specific text like "ddd" aaa bbb ccc ddd eee fff 1 2 3 4 5 6 2 3 4 5 6 0 So that the output looks likes this: aaa bbb ccc ...
1
vote
3answers
120 views

Remove comma from columns in a file if it is at the end

I have a tab separated file contain 19 columns, some of these columns contain comma at the end. I want to removed these comma from all columns if it is at the end. Example: c1 c2 c3 c4 c5 ...
1
vote
1answer
97 views

Arrange data in columns

I have a big data.txt file like this: 6712,04444 6712,02344 6712,02220 6712,02233 5322,00040 5322,02230 5322,42002 4444,03342 4444,03323 11,42023 11,00000 11,23443 11,23232 and then I want to make ...
2
votes
1answer
103 views

Add/Append a column as first column to a tab delimited file

I have a Tab separated file as follows: A B HM 1 BN 2 I would like to add another column to this file such that this new column becomes the first column of the file as shown below: ...
1
vote
1answer
190 views

How to extract unique values within columns

I have a data file with 10,000 columns and 117,000 rows. my original data has a lot of repetition within each columns. it is like: inputfile.txt : 123 124 111 321 124 111 123 000 111 ...
1
vote
5answers
214 views

lines to columns with awk

I have to following sample output: <HARDWARE> <NAME>WIN1</NAME> <OS>Windows 7</OS> <IP>1.2.3.4</IP> <DOMAIN>contoso.com</DOMAIN> &...
0
votes
1answer
58 views

Read all the values of a particular column of a file and store it in another file

I have a file.txt which contains data like below: col11 col12 col13 col21 col22 col23 I fetch 2nd column of all the available rows (no. of rows may vary) using awk '{print $2}' file.txt Now i ...
2
votes
4answers
348 views

Fill empty lines in specific column with values

I have data of the following format: 2342 1 6473 2 7463 2 3647 2734 1 9343 The lines that do not have a value in the 2nd column are empty in that spot (i.e. there is no space, tab etc.). I am ...
4
votes
2answers
215 views

Adding column based on matching of second column

I have two files. The first file has the following format: 10D0325 2465 0 0 -9 -9 10D0598 2567 0 0 -9 -9 10D0562 2673 0 0 -9 -9 10D0175 2457 0 0 -9 -9 10D0241 2209 0 0 -9 -9 10D0954 2312 0 0 -9 -9 ...
-1
votes
2answers
397 views

Loop over columns and store values to associative arrays

I've got a text file containing two columns, like so: 26 0.000342231 27 0.000342231 28 0.000684463 29 0.00136893 30 0.00102669 31 0.00308008 32 0.00308008 33 0.00444901 34 0.00718686 35 0.00718686 36 ...
1
vote
3answers
86 views

Random sampling and outputting the largest value

I have a fairly large data set ~500 million rows. The data set looks like below. Col 1 is float number, col 2 is mac id(device id) 1616.93,ac:22:0b:a6:22:c3 2872.32,c0:bd:d1:36:bb:49 3314.55,d4:0b:1a:...
2
votes
2answers
76 views

Output distribution to a maximal number of columns

I have a bash script foo that provides me with many short lines of output. Think ls -1. To get a more compact presentation, I would like to distribute the output over multiple columns, like ls -C. I ...
-4
votes
1answer
240 views

Removing first three characters from a column

chrII 71865 72972 YBL081W . + SGD gene . ID=YBL081W;Name=YBL081W;Ontology_term=GO:0003674,GO:0005575,GO:0008150;Note=Non-essential%20protein%20of%20unknown%20function%3B%20null%20mutation%20results%...
3
votes
1answer
78 views

Why should you avoid “stringently columnar” input formats?

Doug McIlroy, the inventor of Unix pipes and one of the founders of the Unix tradition, had this to say at the time [McIlroy78]: (ii) Expect the output of every program to become the input to ...
-1
votes
1answer
78 views

Count of Lines within a Range

I'm trying to do a count of all the values (numeric) in the third column of a file that fall within a specific range of numbers. I've found the min and max but have no idea how to do the count now. I'...
0
votes
1answer
515 views

How to set Row & Column in shell Script

I am a beginner in shell scripting. Just made 1 script with the help of others and it is working like we expected. However i want to organize it more. Current Script { date '+%F %T'; "$ipath"/...
-1
votes
3answers
203 views

Need to Split the output in Row & Column

I am just a beginner in shell scripting and currently working on one script which will capture all the Endpoint Name & Ongoing calls on my switch and will send the output to one file. Output is ...
3
votes
3answers
468 views

Specific column level substitution

If I have a file with columnar entries, is it possible to substitute specific entries from a specific columns only and save changes to the same file?? Example a file abc.txt: SR|FRUITS|COLOR| 1|...
10
votes
5answers
2k views

Combining large amount of files

I have ±10,000 files (res.1 - res.10000) all consisting of one column, and an equal number of rows. What I want is, in essence, simple; merge all files column-wise in a new file final.res. I have ...
5
votes
3answers
311 views

Compare two files with four columns

I have two csv files with some log information. I need to compare line to line the field1 (file1) with field2 (file2) with a range of 1 minute (-00:00:01 < time < 00:00:01) and the field5 (file1)...
1
vote
3answers
420 views

Find records present in file 1 also in both file 2 and file 3

I have three files file1.txt, file2.txt, file3.txt and they are of same format. I want to select records from file1.txt which are present in both file2.txt and file3.txt based on column 2 and column ...
0
votes
1answer
282 views

How do I center-align a column in UNIX?

I’m trying to center-align a column using the command column. The output should look like this: temperatures 50 12 89 63 How can I do this?
0
votes
1answer
407 views

make a table output

if it possible to do a snmpwalk in a perl script and put the output in a table to make a sort of association like for each hostname i have in the same line if index and desc i have the script in bash ...
0
votes
2answers
81 views

put data in columns

I am trying to put this output in columns can anyone help? Routeur 2 ==> 89.89.156.112 If_Name :vRtrIfName.1.1 :vRtrIfName.1.2 Routeur 2 ==> 89.89.156.112 If_index 546 789 Routeur 2 ==> 89....
0
votes
3answers
59 views

Creating columns from text output but with multiple word columns

I have the following output: Person 49 Persons Boss 3 HR 21 CEO 93 System Administrator 2 Using column -t produces the following output: Person 49 Persons Boss 3 HR 21 CEO ...
3
votes
4answers
508 views

How do I extract the first integer from text string in a column of a tab-delimited file?

I work in Medical Genetics and often have delimited text files where in one column (ex. column 5) there is a text string with a "mutation" in our jargon: c.2458C>T or c.45_46delAA or c....
3
votes
2answers
1k views

How do I insert new columns into a .csv file?

Example Data: "Monday","12345","Friday" In the above file, I want to add a new column in between 12345 and Friday. How can I do that ?
2
votes
1answer
154 views

Produce aligned columns in a shell script

In shell how do I have an even length of spaces by the length of words on my menu? I've tried to get the length of the longest character string and then create each column length by the longest ...