Skip to main content

All Questions

Tagged with
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
4 answers
3k views

How to extract columns before and after a string ocurrence

I have a text file. That looks like: www.ac.com has address 6.1.1.146 www.ac.com is an alias for ac.com. www.ac.com is an alias for ac.com. www.ba.net is an alias for www-bn.gs.ba.com. www-bn.gs.ba....
user9371654's user avatar
-3 votes
1 answer
157 views

How can we find all the files under a directory whose contents contain any of several strings? [duplicate]

I was wondering how to find all the files under a directory whose contents contain any of several strings word1, word2, word3, ...? Thanks.
Tim's user avatar
  • 103k
4 votes
4 answers
686 views

If Else, Awk NR: How to remove a section header of table where there are no entries

I am trying to summarise a table of data that changes everyday. I have already summarised the table to only display rows with entries that are larger than 30. However, on some days, there are no ...
tthhss's user avatar
  • 51
0 votes
1 answer
136 views

To Make File name according to their IDs

I want to replace each file name with their specific IDs. My files are 30,000 and so their respective IDs. Can it be possible to fetch ID which is inside in each file on line number 2 and become a ...
Bushra's user avatar
  • 29
3 votes
1 answer
1k views

How does opening a file descriptor effect memory

Let’s say I have a 250MB file that I read from by opening a file descriptor. Does the entire file get dumped into memory and stay there until I close the file descriptor? How does that differ from ...
EnterUserNameHere's user avatar
0 votes
2 answers
4k views

Cat a file with grep, showing current "cat" line

I search through a HUGE file with cat and grep. I need to know on which line is cat all the time. If i want to search ball: cat file.txt | grep ball FILE: football tennis hockey basketball ... ...
XYZT's user avatar
  • 13
2 votes
3 answers
2k views

Add mtime to grep -c output and sort the output by mtime

I have a directory full of logs named in the following style: info.log00001 info.log00002 info.log00003 ... info.log09999 info.log My current output (using grep -c) I need to analyze the ...
Sam's user avatar
  • 123
1 vote
1 answer
399 views

How to grep several files using part of filename as a pattern?

I have a folder which includes several files named order[ID].log where [ID] is a string e.g. orderID1.log orderID2.log orderID3.log orderID4.log ... I need to write a script in Linux to grep each ...
Alan Yu's user avatar
  • 15
0 votes
1 answer
1k views

SED - Find and replace with special characters (#, , % )

I'm aware that this is a really simple question, but I'm struggling to find a solution to this . I need to automatically find and replace in the /etc/aliases file the following section: # Person ...
hoisu's user avatar
  • 137
4 votes
4 answers
987 views

Find lines in (multiple) files that contain the given line in an input file

If I have a number of files like the following: file1: 123 456 789 012 file2: line1 922 line2 392 line3 456 line5 291 line6 201 ... file3: line1 111 line2 123 line3 19 line5 542 line6 ...
galois's user avatar
  • 241
2 votes
1 answer
241 views

string search using awk

I have file-1 which has list of transaction id . File -1 201503301616|9b8791b3-f860-409f-aad0-24debf834c1b|10.233.18.29.677220869928387637969 201503301616|9b8791b3-f860-409f-aad0-...
Dhyan's user avatar
  • 23
5 votes
4 answers
3k views

How to remove text matching specific patterns from a file

I want to compare two files to check for differences between them, fileA and fileB. fileA is like a template file and fileB is the file which I want to compare to it. Anytime I find a difference I ...
didjek's user avatar
  • 151