3
votes
3answers
73 views
Transposing rows and columns
I have a file with the lines like below.
title1:A1
title2:A2
title3:A3
title4:A4
title5:A5
title1:B1
title2:B2
title3:B3
title4:B4
title5:B5
title1:C1
title2:C2
title3:C3
title4:C4
title5:C5
...
3
votes
2answers
51 views
get the Xth argument in each line
I would like to get the second argument in a line of output. For example:
ps aux
gives me an output that contains the cpu-usage %CPU in the third column.
How can I filter the output so I have only ...
4
votes
1answer
92 views
+50
Parsing columnized data
I have some columnized data which I would like to format a little further. It looks like this:
$ getStats | grep ESTABLISHED | column -t
all tcp 117.54.56.131:80 <- 10.42.100.211:63752 ...
4
votes
2answers
104 views
How to adjust column width in Linux command output
When I used this command on Red Hat Linux
/usr/sbin/ss -i
I get the following output below:
State Recv-Q Send-Q Local Address:Port ...
2
votes
2answers
63 views
Extract a column from whitespace-separated fields that are not aligned
How can we extract a column from output in which whitespace is not in a regular format?
For example, when we type ps -ef, it shows all the process, process id's.... etc. How can we get only the last ...
0
votes
2answers
141 views
Align columns in ASCII file
I have a text file that looks like his:
#c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13
4599 995,274 2523,658 ...
4
votes
2answers
137 views
How can I use column to delimit on tabs and not spaces?
I'd like to use Unix column to format some text. I have fields delimited by tabs, but within each field there are also spaces. column delimits on white space (tabs and spaces). How can I make column ...
2
votes
2answers
73 views
add fields from different files
I have two files A and B with the same number of lines. Each of them has multiple columns.
I want to add field 6 in file A with field 3 in file B for each line. e.g.:
file A:
2769 RUT10EKl3fY 0 ...
2
votes
1answer
216 views
intersection of two files according to the first column
I have two files
in file A, there are sequence_numbers
in the other file B, there are many columns, and the first column is sequnce numbers,
I want to get a files with all the lines in the B with the ...
1
vote
3answers
116 views
How to sort and join at the same time?
I have 2 files, one having 2 columns, another having 1 column. The second file is sorted using sort -u. Now the task is I need to join this column with the first column of the first file, which is not ...
2
votes
2answers
290 views
How do you truncate all columns in a file to a specific length?
Given columned text in a file that is delimited by a certain character, how do you truncate the width of either a specific column(s) or all columns?
The use case is that I am reading some log files ...
6
votes
7answers
255 views
Swapping an unlimited number of columns
I have a file with columns. See below for an example:
a b c ... z
1 2 3 ... 26
I'd like to swap all columns where the 1st becomes the last, the second becomes the one before last...etc..
z y x ...
3
votes
2answers
104 views
Column mismatch and substituting
input.txt (tab-delimted)
TTTTOTTT00000000008 RTTTT899 5.00E-28
TTTTOTTT00000000046 RTTTWRR 3.00E-31
TTTTOTTT00000000051 2.00E-11
TTTTOTTT00000000051 7.00E-12
TTTTOTTT00000000054 ...
4
votes
4answers
2k views
Compare two files: lines present in one, not in the other, by one column comparison
I need to compare 2 files. Column 1 is the same in both files. Column 2 is what I want to compare: I want all lines in file 1 that are not in file 2 when comparing column 2. Column 3 is different in ...
2
votes
1answer
188 views
text processing-perl
I am a biologist. I would like help of computer experts to help in text file editing.
Here is what the input file looks like:
##dsfsd2
##sdf-sdf sasg 5.6.3
gi34_ex Gen CDS 161 317 . ...
5
votes
3answers
1k views
How can sed output be formatted like printf's formatted printing?
Can sed replace text with a string formatted like printf's formatted printing?
The following sed command replaces a line starting with the current value of "$domain" with several values specified in ...
3
votes
5answers
842 views
Add character to beginning and end of column
I have a file like this:
78@54@this@15@23
65@22@is@92@16
34@12@an@14@18
13@42@example@52@22
And I want to change it to this:
"78"@54@"this"@15@23
"65"@22@"is"@92@16
"34"@12@"an"@14@18
...
4
votes
1answer
467 views
Linux sort second last column
I would like know how to sort the second last column ? It has the word "days=" in front of the number. I'm able to get the column with awk '{print $(NF-1)}', but sorting is wrong.
457000 ...
