All Questions
237 questions
4
votes
3
answers
220
views
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 ...
2
votes
3
answers
86
views
Printing a specific section everytime search results are matched
I have a pretty basic text file on a Linux machine that has stuff like Chapters, Dialogues and References.
This is what it looks like
Chapter: 1 One: Birds and Trees
Birds are beautiful and trees ...
-3
votes
2
answers
100
views
Using awk, append a value in last field in csv file based upon value in specific field
input.csv -
"family_guy","Brian","b47f0a80-d848-4d81-a45b-7ba930e6048b","son"
"family_guy","Brian","b47f0a80-d848-4d81-a45b-...
-1
votes
5
answers
301
views
Delete all lines after n lines below the line containing the first match
If a file contains the following:
Line 1
FooLine 5
Line 2
Line 55
Line 3
Line 4
Line 5
Line 6
Line 7
Line 5
Line 8
Line 9
How to delete the lines below two lines after "Line 5", so that the ...
-1
votes
1
answer
195
views
Create new CSV files based on latest timestamp data
I have a script that accesses multiple dat files and produce csv files based on previous day’s data. these DAT files are updated on per minute bases with data from various instruments.
Script snippet:
...
0
votes
2
answers
136
views
AWK: If two key columns match between files, add the 16th column of one file to the matching row of the other while keeping non-matching rows
I have two tab separated files (FileA.tsv and FileB.tsv).
FileA.tsv
id
graph
circle
several columns...
length
196-0
196
0
----
12874
195-1
195
1
----
12874
56-0
56
0
----
3349
115-1
115
1
----
5297
...
3
votes
3
answers
251
views
How do I use awk to properly extract lines from a file using numbers from another file?
I'm using bash shell. If I have a file of line numbers
1
4
7
9
and another file of lines where the first element is a number followed by a string of text
1,Michael Jordan
2,Karl Malone,
3,Charles ...
0
votes
2
answers
1k
views
Commands runs in shell, but not in script: no directory found error
I have a few commands that don't run as a script.
It's supposed to create a bulleted list of the file names, then sort the columns of each file alphabetically, grab the second and its matching third ...
1
vote
3
answers
176
views
Using AWK to search row and replace to the specific values from another row
I want to replace the '1' from the first row with the value given in the second row. Here is the input dataset:
0,0,1,1,0,0,1,1,0,1,0,1,0,1
65,70,75,80,85,85,90
Desired output:
0,0,65,70,0,0,75,80,0,...
-1
votes
1
answer
62
views
comparing multiple column values between two files
I have two CSV files on a Linux machine, containing data as:
File A
Sunil,21,write a line,2312,12-03-2022
Ashok,22,write a para,2312,12-03-2022
Sam,23,create file using,2312,12-03-2022
FileB
21,...
2
votes
4
answers
700
views
Count lines ending in "*"
I have several files in a directory with this kind of content:
Wood *
Nails
Large Hammer *
Some names have a star after them, some don't. I have multiple files with such content. In each file a ...
0
votes
1
answer
147
views
Permutation with bash - Spread Five over Eight
Assuming I have the values A B C D E and eight places 1 2 3 4 5 6 7 8. How can I get all possible combinations printed with two- and three-time repetitions?
Example:
1 2 3 4 5 6 7 8
_______________
A ...
0
votes
0
answers
101
views
Personalize .txt files with data taken from a .csv file. (Replacing variables)
I want to customize text files for a big list of people. The dirs and files are made already. For each person there are 6 text files. The 6 text files together contain 7 variables: ${FULLNAME}, ${DOB},...
2
votes
4
answers
163
views
If column of one row match column of another row then add
I would like to sum numerical values listed in the columns of the table below based on entries that were given in the first column of the same table. The table content is as follows:
10,Mumbai,0,4,5,0,...
1
vote
2
answers
324
views
Extract field and number of occurrences per line
I have this file:
John Green', 'Age: 32', 'State: New York', 'Total cars: 2', 'Manufacter: General Motor', 'Model: Pontiac', 'Year: 2000', 'Manufacter: Ford Motor', 'Model: Endeavour', 'Year: 2010
...