Skip to main content

All Questions

Tagged with
1 vote
2 answers
58 views

Need to make multiple multiline replacements in file

I have a file with multiple "paragraphs" like this: <type>TRANS</type> <attributes/> <specification_method>rep_name</specification_method> <trans_object_id/&...
Todd Porter's user avatar
0 votes
5 answers
160 views

How to add content to a file before the last } character using Busybox utilities?

There is a file with contents { "first_name": "John", "last_name": "Smith", "is_alive": true, "age": 27, "address": { ...
Maxim's user avatar
  • 119
0 votes
5 answers
383 views

print characters between a specific pattern containing <>

i am asking for your help please. I reviewed a lot of sources and did some testing with awk and sed, but i can't get it to work. Below is a snippet of a config file which i could get an output via ...
AKSNET's user avatar
  • 13
1 vote
7 answers
313 views

Find all lines between two patterns, EXCLUSIVE of the second pattern?

Consider that I have the file listed below. I need to select all lines from every instance of the regex pattern Word A to before the regex pattern Word D. Word A Word B Word C Word D Word E Word F ...
RonJohn's user avatar
  • 1,144
-1 votes
2 answers
136 views

Grep a log file for SQL queries and their execution time

I have an application log file that also captures the execution time for each executed SQL statement, like below:- Sample logs: I 2023-11-15 07:18:00.743Z 1760463 37 ZVRwqItu6aw-b8eejMLI_gAAAAU 1@...
Arpit Jain's user avatar
-1 votes
2 answers
270 views

Filtering out values in a column that are zero

I have the following dataset: 071,36,035,08422,46217,00000,1,A,Broadalbin village (pt.),New York,18,46,46,46,45,45,44,46,44,46,43,43 071,36,045,29322,56209,00000,1,A,Glen Park village (pt.),New York,...
Mathew's user avatar
  • 243
2 votes
5 answers
584 views

Grep Multiple Pattern located in different lines and print in the same line

I'm trying to find a way to grep information in the file that located in the different lines and one of the pattern is contain pattern of date and time. below is the input unwantedtext unwantedtext ...
Ajie Pahlevi's user avatar
0 votes
3 answers
327 views

How do I use grep, awk, or sed to get a substring of a line up until a string literal?

I am trying to process a text file and omit a certain string literal if it occurs at the end of the line. E.g.: Source: ABC 123 DEF, characters I don't want GHI, these characters are ok Desired ...
Evan Harmon's user avatar
3 votes
3 answers
730 views

Find files matching one pattern, but not another, using grep, awk or sed [duplicate]

I need to locate .php and .pl files that do not contain one string (e.g. aaa), but do contain another (e.g. bbb). I'm currently using this command: find /path/ \( -iname '*.php*' -or -name '*.pl*' \) -...
Krackout's user avatar
  • 2,742
2 votes
3 answers
214 views

Replace the last half in every line of a file with corresponding part in another file

I have two files A and B. Every line in both files is considered an item. The format of every item is fixed, consisting of a key and description, separated by a space. as shown in the example below. ...
echo's user avatar
  • 31
0 votes
3 answers
89 views

grep from a specific value to specific value

For example, I have a file with data: [2023-03-21 12:27:19 +0000] some_data [2023-03-21 12:27:19 +0000] some_data [2023-03-22 12:27:19 +0000] some_data [2023-03-23 12:27:19 +0000] some_data [2023-03-...
Mexanizm456's user avatar
-2 votes
2 answers
91 views

Select all the text or characters between 2 text patterns that are repeating

Following is the sample .log file (there can be more lines in this) 2022 User abc (iii) 2023 defaa <party> ttt 2222221 User def (bbb) 20222 defaa <accoun> ttt 2222 User dddd (aaa) 3333 ...
John Doh's user avatar
3 votes
2 answers
396 views

Extract first word from txt file before ending with "/" sign in linux which contains "db" word in txt line

I have abc.txt file which contains two lines. I want to extract first word in line which contains db word in particular line. abc.txt: XYZ/db_abc.sql ijkl/tables/table_name/tl_abc.sql When I tried ...
Divyank's user avatar
  • 147
0 votes
1 answer
86 views

"grep -A" but with some lines removed

The problem The output of grep -A 4 davidson file.txt gives me: davidson 0 27 |r|= 0.00244 e= [-0.04073962 0.42777949 0.44157777 0.45997235 0.45997235 0.51613738 0.55005554 0.5538866 0....
Nike Dattani's user avatar
-2 votes
4 answers
80 views

How to keep previous and current line if the previous line contains common text?

How to keep previous and current line if the previous line contains common text? I have a main file like this: Hello_world Anna Frank Jeremy Hello_earth Jessie James I would want 3 output files like ...
jovicue's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
39