All Questions
44 questions
0
votes
2
answers
44
views
Capture and print on the exact match from a file
I am trying to use grep to match only a specific part of a row in a file.
The file is a huge csv file with some columns containing json with commas so it is hard to figure out which column what I am ...
-2
votes
2
answers
1k
views
Generate strings from regular expression in bash
How in Bash to generate a string given by a regex expression and pipe it to another command?
For example:
> $RANDOM | regex "{abcdef\d}[8]" | grep "1{3}" | less
I did not find ...
1
vote
1
answer
56
views
fix filenames with wrong starting and ending character(s) in Bash, mass renaming
I need to rename a lot of files by removing the 1st and the last characters (before .ext).
WRONG>
'1st moto ride [Aug '99]'.mp4
'Samuel' Song'.mp3
'Plane Landing'.avi
'"Ode" (sort of) to ...
0
votes
1
answer
599
views
regular expression - command not found on terminal
I am trying to grab my_name 369 from file.txt
I input this grep line with regex but it return an error. I have tried using egrep and it did not work.
Input:
my_name 369 == match
my_name 161 == match
...
0
votes
4
answers
528
views
Changing the name of a file based on a part of its original name that are between the first two instances of a character
I am trying to change the names of my files based on the string between the first two instances of "|". This is what my problem looks like:
>1234|interest1|randomstuff1.txt
>5678|...
-1
votes
1
answer
40
views
bash + verify if file that ended with many combinations exists [duplicate]
we can have the /tmp/file.1 or /tmp/file.43.434 or /tmp/file-hegfegf , and so on
so how we can verify in bash if any /tmp/file* exists ?
we try as
[[ -f "/tmp/file*" ]] && echo "...
0
votes
1
answer
560
views
sscanf equivalent in shell script
I have a file which has some stats and counters stored for some ACL rules. I want to design a shell script to read that file and parse those counters.
I have done the similar thing in c programming ...
0
votes
1
answer
209
views
I'm trying to understand how to shorten regex
I'm trying to list all directories that are 1GB or larger. I know I could use ncdu, but at the moment, I'm just trying to understand how to shorten regex...
I found this command, du -h . | grep '[0-9\....
-1
votes
2
answers
100
views
SED - Generate line only if match some words in OTHER LINE [duplicate]
Assume I have 2 files in a folder
...
product: Nike New Awesome Running Shoe
price: 123
color: black
...
...
product: Nike New Awesome Salloon Soccer Shoe
price: 123
color: black
...
I need to ...
-1
votes
5
answers
178
views
SED - Generate line using some content of other line
I have some files in a folder
Each file has this structure:
...
product: Nike New Awesome Shoe
price: 123
color: black
...
I need to accomplish bellow scenario using single SED command, in all files ...
0
votes
1
answer
1k
views
sed + remove line with word match and only if comment appears in beginning of line
delete lines with word match is easy
for example when we want to delete the line that match the word - max.connections
sed '/max.connections/d' /home/conf.txt
but how to delete the match lines as ...
0
votes
0
answers
18
views
Remove Exact Strings From a File [duplicate]
How do I remove exact strings using sed, tr or awk
{98406c4acbf0f57b3ccbc923a6d507f422d9bd8656398f53433e}HTTP/1.0 200 OK
What I want to remove is HTTP/1.0 200 OK
I tried to do sed but there is a ...
1
vote
1
answer
4k
views
find all file extension recursively from directory and copy all extension files to single directory [duplicate]
I have directory with sub-dir where it has multiple extensions file. I would like to copy all ext files to single directory "scan". Tried running following cmd but doesnt work out:
find . -...
0
votes
4
answers
3k
views
How to extract numbers (digits only) from other words in text with bash
Using Bash, I want to display the number of lines that contain at least one number (a number is only made of one or several digits) in an arbitrary text. I also want to display detected numbers one ...
0
votes
1
answer
697
views
Parse audit log commands as a complete command with arguments
I have audit logs that looks as follows:
type=CWD msg=audit(1613110144.560:260397): cwd="/"
type=PATH msg=audit(1613110144.560:260397): item=0 name="/usr/bin/sed" inode=393388 dev=...