All Questions
Tagged with text-processing shell-script
1,125 questions
0
votes
2
answers
87
views
List and count ciphers used by cryptsetup in /dev/mapper devices
In my Linux Computer there are many files called file1, file2, file3 ... in /dev/mapper/.
Now I want to have an overview from the files what cipher is used how often.
I tried this
for i in /dev/...
4
votes
3
answers
220
views
Add columns from variable number of files to base file
I'm dealing with a series of bed files, which look like this:
chr1 100 110 0.5
chr1 150 175 0.2
chr1 200 300 1.5
With the columns being chromosome, start, end, score. I have multiple different files ...
1
vote
3
answers
84
views
Loop ip list through geoiplookup and delete lines that do not match criteria
Thanks in advance for any ideas you present.
My current project has me trying to loop a file containing a list of 1000's of IP addresses through geoiplookup and piping it to sed to delete all lines ...
-2
votes
3
answers
143
views
Bash script to uncomment lines with leading spaces on a file with specific pattern
I try to uncomment specific lines from a file with patterns in oracle linux 8.6 using bash. There are leading white spaces on certain lines where the comments are not removed. I tried to uncomment the ...
0
votes
1
answer
115
views
Find all files in directory and apply commands to each of them
I want to apply commands below to all files in a directory instead of one file.
cat file.txt | sed -E "s/\@([0-9]+)\W+~(.*?)/\1 \2/g" | tr -d '~'
cat file.txt | sed -E "s/\@([0-9]+).*\~...
2
votes
3
answers
86
views
Printing a specific section everytime search results are matched
I have a pretty basic text file on a Linux machine that has stuff like Chapters, Dialogues and References.
This is what it looks like
Chapter: 1 One: Birds and Trees
Birds are beautiful and trees ...
2
votes
7
answers
730
views
Shell Script to Normalize the data
We have requirement to normalize the data ... Item field is comma delimited and irregular and it may have any items from 0 to max (lets say 100)
Input:
key1|desc field|item1,item2,item3,item4|extra ...
-3
votes
2
answers
100
views
Using awk, append a value in last field in csv file based upon value in specific field
input.csv -
"family_guy","Brian","b47f0a80-d848-4d81-a45b-7ba930e6048b","son"
"family_guy","Brian","b47f0a80-d848-4d81-a45b-...
-2
votes
1
answer
362
views
How to replace a parameter's value in json file with a value taken from a different text file
I have a a large number of JSON files on a Linux machine, where I need to change the value of a parameter with value taken from a different text file.
E.g.: If the JSON file has values like:
{
"...
0
votes
1
answer
57
views
Replacing variable correctly in alias function
I'm trying to create an alias function to remove inputted line from file:
function remove_line(){
line_to_remove="'s/^"$1"$//g'"
sed -i $(line_to_remove) my_file
}
...
3
votes
1
answer
515
views
How can I use $0 in Makefile?
I would like to include the following command (taken from here) in a Makefile. A simple version of my Makefile script containing the command is:
copy_files:
sed 's/^/\./' ./input_file | \
...
7
votes
5
answers
1k
views
How to create grep output in the order of the input file?
I have a scrambledA.txt with data in a list like so:
efrrsu
aehmmr
aeeglnr
alnors
acflno
aaahmy
aceimru
1469en
aelprsy
cehrry
and a corresponding wordlistC.txt that contains many many key-value-pairs:...
0
votes
0
answers
69
views
I want to print the actual gio launch command (e.g.)$ echo " gio launch /usr/share/applications/abiword.desktop" would print: $ Exec=abiword
I am aware that I could just use something like :
grep Exec= /usr/share/applications/abiword.desktop
I could also do something like:
abiword=$(grep Exec= /usr/share/applications /abiword.desktop)
...
2
votes
4
answers
191
views
Need help in removing ellipes (...) from a file using shell script
Need help in removing ellipes (…) from a file using shell script. I used sed command in various forms, but it doesn't help when running in a Unix box.
Following commands were used but didn't help when ...
-1
votes
1
answer
133
views
I need help making this bash script run faster [closed]
I have a script that takes a local log file, reads each line, ID's the card and the IO type, extracts the relevant data string, compares that string to definition files and assigns a T or F value to ...