Skip to main content

All Questions

Tagged with
0 votes
6 answers
224 views

search pattern and print in same line

I have a big .txt file in below format Pin name="AR_OP" status="f" Pref x=997.6800 y=2327.0400 side=N width=0.0400 depth=0.3750 / Layer id=1 -- Pin name="...
Shreya's user avatar
  • 139
1 vote
1 answer
111 views

Match if a column from one file partially matches a column in another file then print columns from both files

I have 2 files in which the fields are comma separated- aks@dev1:~$ cat dir.txt /home/aks/cleanup,512 /home/aks/git,208 /home/aks/github,424 /home/aks/predirsize,216 /home/aks/sample,288004 aks@...
user1980821's user avatar
2 votes
1 answer
439 views

How to find keywords in multiple files which often appear together?

I want to find keywords, which often occur in relation to each other. Example A directory contains markdown files, each with some keywords on the last line: $ tail -n 1 file1.md #doctor #donkey #...
Luca Etienne Schulz's user avatar
0 votes
3 answers
773 views

Combine multiple awk functions

I'm very new to awk, I'm trying to do the following in an environment that doesn't support grep -P and doesn't have Perl installed either. Given I have a list of env variables starting with a prefix, ...
adamors's user avatar
  • 103
2 votes
2 answers
582 views

Print content between first matching brackets

Input example: START{ some text { more text} almost there } nothing important{ ... Desired output: START{ some text { more text} almost there } First open bracket could ...
GeoCap's user avatar
  • 131
2 votes
2 answers
280 views

I want to extract particular column from the file, column number is given in different file using shell scripting?

I want to extract particular column from the file1 by comparing with file2 in which column number is given that should be extracted from file1. File 1 (source data) look like this: 1 2 3 4 5 ...
claudia smith's user avatar
1 vote
1 answer
198 views

Compare three files: lines present in all of them using column comparison

I have three files 2d.tsv, 3d.tsv, 4d.tsv, and they are of the same format (same number of columns with the same data type, but with different numbers of rows). I want to select rows that are present ...
Lucas Farinazzo Marques's user avatar
2 votes
2 answers
833 views

How to look for a specific string after a matched string from a file using sed, awk or grep

Sample of output stored in a file: Provides: Red Hat Satellite Red Hat Developer Toolset (for RHEL Server) SKU: TGV123 Contract: 59104 Pool ID:...
justlearning's user avatar
2 votes
1 answer
87 views

any way to make this command chain shorter or better

I am using this command chain to filter out bot/crawler traffic and ban the ip addresses. Is there any way i can make this command chain more efficient? sudo awk -F' - |\\"' '{print $1, $7}' access....
Dan's user avatar
  • 193
0 votes
2 answers
1k views

Skip lines with matching pattern and delete lines with condition matched

I have file with following format : Q L A D 1 10 2 21 3 22 4 5 5 9 I need to skip lines which starts with 'Q' or 'L' and delete lines where second column has value greater than 10 and save the ...
shome's user avatar
  • 323
4 votes
3 answers
2k views

Shell script to extract data from a list of files and saving it as a csv

I'm on CentOS. I have a list of files that I want to read, extract data from them and organize it as a csv file. The log files text format is: ... {"name":"test-api","hostname":"ci47","pid":3202,"...
tamerbak's user avatar
1 vote
3 answers
77 views

Extracting a single line containing the highest value in a given column from a text file from each consecutively numbered sub-group/family

Within my text file, I would like to take the line containing the highest value present in column 3, from each consecutively numbered family (i.e. family_1, family_2 etc.) from column 2 and input ...
Alex's user avatar
  • 13
-1 votes
2 answers
456 views

How to print the first line which include special word [closed]

Print the first 123 below XXX AAA BCB DDD 123 123 XXX CCC 123 123 MSM 123
youngchaw's user avatar
0 votes
1 answer
86 views

How can I add some text after some sequence of text if this sequence matches certain criteria using Shell script?

I want to add a statement just after the text matching the conditions mentioned in a shell script, Below is my sample File(SQL File) : begin AFFECTED_ROWS := 0; UPDATE table_name SET column1 = ...
Hargun Suri's user avatar
0 votes
3 answers
231 views

adding a new line character to a row

I'd like to extract the 2nd field and transpose it to become a row cat > temp1 1 73 2 74 3 75 My approach : cut -f2 temp1 | tr '\n' '\t' > temp2 The result : temp2 73 74 75 ...
Aron's user avatar
  • 21

15 30 50 per page