All Questions
1,090
questions
1
vote
2
answers
49
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/&...
-1
votes
1
answer
53
views
awk inside function causing errors
I'm trying to add the following to my .bashrc:
cpu_info() {
top -b -n1 | grep Cpu(s) | awk '{print $2 + $4}'
}
but bash is telling me:
bash: .bashrc: line 131: syntax error near unexpected token `...
0
votes
0
answers
70
views
Text processing grep and awk together on live script not working
I am using ssh to login to a remote server (Ubuntu), and then issue a command which outputs text/value each sec (live script).
In the live output, I want to filter out the lines containing '...
-3
votes
4
answers
109
views
How to catch all lines of a repeating pattern and do some actions with the subresults
I am looking for a possibility to catch in a repeating text pattern all variable amount of lines between them and then do an action with it in bash.
Example text:
Total:
text1
text2
Total:
text3
Total:...
2
votes
2
answers
63
views
Listing a certain part of filenames and their contents
I have a Linux machine with BusyBox,
which has a directory called /data/var/lib/connman.
That directory holds some directories that I'm not interested in.
But it contains many .config files that ...
0
votes
5
answers
158
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": {
...
1
vote
3
answers
121
views
print a text block / lines between pattern using grep or awk
My file file.txt looks like this:
[NamesA]
Andreas
Alex
[NamesB]
Bernd
Bruno
[NamesC]
Casper
[NamesD]
Doris
I would like accomplish the following 3 different outputs, using grep or awk to use it ...
0
votes
5
answers
375
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 ...
1
vote
7
answers
311
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
...
-1
votes
2
answers
133
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@...
-1
votes
2
answers
266
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,...
1
vote
2
answers
189
views
Recursive pattern search - output formating: for each match file print out the specific file name "\n", line number, sentence matched "\n" in colors
I want a file content search command, under Linux so that:
it will search on specified files, e.g: md, txt, htm.
recursively from the folder and its subfolders, e.g: .
the content search can be ...
3
votes
3
answers
110
views
How to recreate grep -f with awk
I have a large file with lots of unnecesarry info. I am only interested in section between edit and next and handle them as one entry. I manage to filter it down like this....
'
awk 'BEGIN {FS = &...
0
votes
4
answers
185
views
How to view a log file that's worth 10GB+?
The ways that I've thought of:
If you get to reproduce the scenario in real time. Use
tail -f application.log | tee /tmp/tailed_log
But it's not sure that we'll get to reproduce the scenario in real ...
2
votes
5
answers
578
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 ...