All Questions
1,090
questions
-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 ...
-1
votes
3
answers
686
views
Searching in a CSV for multiple values and get the associated values from it
I have a file.csv
"ItemNo","Name","Weight"
"a001","Item a","1.1"
"a002","Item x","1.2"
"a003","...
0
votes
2
answers
73
views
for loop with grep not returning record by record [closed]
I have the below for loop in my shell script:
#!bin/ksh
touch output.dat
IFS=">>>"
i=0
for stm in `grep "cpdctl dsjob run-pipeline --project " input_file`
do
echo "...
0
votes
2
answers
86
views
Trying to get a desired output from a text file
I have a output like this in a text file, where ^M represents CR
Last login: Sat Jan 22 09:49:50 2023 from 10.1.1.1^M
Cisco Router
uptime
exit -f
Connecting user mike from 10.1.1.1
******************...
2
votes
3
answers
50
views
How to collect both full lines, and matching part of line?
Is it possible to output both the full line and the matched parts of some line?
Suppose I have this input
low [ 0]: 0xffff0000 Interesting description A
hi [ 0]: 0xffff00a0 Interesting description B
...
2
votes
4
answers
637
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
4
answers
72
views
Awk multiline change
I have the following file for datadog
########################################
## System Probe Network Configuration ##
########################################
# network_config:
## @param enabled -...
0
votes
1
answer
72
views
command for multiple input and multiple output with different extension
I am performing some operations using the grep, sed, and cut commands on a Linux machinete:
zgrep -A1 "^module" *.v.gz | sed -n -e 's/^\(module \)*\(.*(.*)\).*$/\2/p' | cut -f1 -d"(&...
1
vote
1
answer
231
views
command for multiple input and multiple output
I am performing some operations using the grep, sed, and cut commands on a Linux machinete:
zgrep -A1 "^module" *.v.gz | sed -n -e 's/^\(module \)*\(.*(.*)\).*$/\2/p' | cut -f1 -d"(&...
0
votes
3
answers
80
views
script using linux command to search word
I have the file, In the file data few lines have only one word, if such a case is present i want to print following line as the present line
can I get some tips for this
grep -E "module" ...
0
votes
1
answer
1k
views
How to return true if string is found in a file using awk?
I have a file that looks like this:
xxxxx,aaaaaa,abab21323,ccccccc
I need a script that runs some command if a file contains a string given as a variable. If not, do some other commands.
This is my ...
1
vote
2
answers
299
views
Extract IP:PORT from a curl output
I want to get list ip:port from the curl output of
curl https://www.gametracker.com/search/?sort=5&order=ASC
I cannot post the whole output as it is very big, just posting the part from where we ...
1
vote
4
answers
149
views
Sed delete everything before and after characters
I'm running on android this
Command:
dumpsys activity activities | grep mFocusedApp
Output:
mFocusedApp=ActivityRecord{273535b u0 com.any.some/.app.AnyActivity t5595}
Expected:
com.any.some
I need ...
-3
votes
2
answers
80
views
Grep first charcter from the string
10:30:01
10:35:01
There is a time in a format, where i want to grep:
Case1: 1 from 10
Case2: 3 from 30
Output as
1
3
0
10-17-22 date in a format where i want to grep 10, 17, 22, seperately.
Output ...
0
votes
0
answers
78
views
I need to grep using string "degraded" and I want the output with Health State,Name, and Type. This is in Name Value Pair format
Name = Server1.domain.com
Description =
Tenant =
Type = host
Address =
Netmask =
OS type = VMware ESXi
Ignored address =
Host ...