All Questions
21 questions
4votes
3answers
220views
Add columns from variable number of files to base file
I'm dealing with a series of bed files, which look like this: chr1 100 110 0.5 chr1 150 175 0.2 chr1 200 300 1.5 With the columns being chromosome, start, end, score. I have multiple different files ...
43votes
4answers
30kviews
Split long output into two columns
Is there a simple utility or script to columnate the output from one of my scripts? I have data in some form: A aldkhasdfljhaf B klajsdfhalsdfh C salkjsdjkladdag D lseuiorlhisnflkc E sdjklfhnslkdfhn ...
2votes
3answers
6kviews
Comparing csv files to lookup column 1 then check values in column 2
OK, I will try and explain what I need to do as best as possible. Basically I have two CSV files, as per the examples below: File 1: Column 1, Column 2 abc , 123 def , 234 adf , 567 File ...
2votes
4answers
2kviews
How to not display a column that has all NULL values in a file
I have a file that has let's say, 5 columns(obtained by redirecting the results of a Sybase select query). Each column is separated by a tab. I need to filter out the columns that have all NULLs. Any ...
3votes
3answers
226views
Read columns from file, then column into an exsisting csv file
Essentially, I have a csv file that contain multiple columns, called cols.csv 1,a,100 2,b,200 3,c,300 4,e,400 and I have a new csv file that has one column, called col.csv f g h i I want to copy the ...
7votes
3answers
3kviews
Print a multiline variable in a column
I have a script that collects values from a cluster. The values, in some cases, have multiple lines. I have a printf format that specifies how the data should be positioned however, it doesn't take ...
4votes
4answers
3kviews
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....
13votes
5answers
5kviews
What command(s) will feed a tab-delimited text file and cut each line to 80 characters?
I've got multiple-line text files of (sometimes) tab-delimited data. I'd like to output the file so I can glance over it - so I'd like to only see the first 80 characters of each line (I designed the ...
6votes
3answers
5kviews
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 into a ...
9votes
5answers
4kviews
Joining two files with unique identifier
I have two files with approximately 12900 and 4400 entries respectively, that I want to join. The files contain location information for all landbased weather observing stations around the globe. The ...
1vote
3answers
361views
I want to empty one column, but I want to keep the header name in unix
I am using below command to empty the column but I want to keep the header row, how can I do it in the same command? awk -F "," '{$10="";}1' OFS="," InputFile.csv > test.csv
1vote
3answers
2kviews
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 ...
2votes
2answers
17kviews
How to get the value from rows and columns from text file in bash?
I am working on a bash project. I need to get all the values (one at a time because I will be using them somewhere else) from a text file. The text file I will be getting is structured like this: ...
3votes
3answers
2kviews
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|...
3votes
1answer
344views
Can I force column to emit whitespaces instead of tabs?
I'd like to tabularize a file with the column command: $ column -c 60 file.txt The output is nice on the screen, but unusable for my purposes because the items are seperated by tabs. for further ...