The regex tag has no wiki summary.
3
votes
1answer
29 views
match files based on an md5 using find
I have a bunch js and css files in a directory. Some of them have been given a name based on an md5() of their content (looks like f10521a21bb013cb81e0909809818ad6.js). I'd like to match these files ...
2
votes
1answer
63 views
escaping a single dot with double backslash - awk
"effective awk programming" book has an example on Field-Splitting. here is the example:
If you want fields to be separated by a literal period
followed by any single character, use ‘FS = ...
2
votes
1answer
56 views
Why doesnt ctrl+d work with this?
I wanted a simple way to process text in my clipboard without having to create a file. I tried using the following line:
awk '{print $1}' <(cat)
but I couldn't send cat the EOF character using ...
1
vote
3answers
57 views
sed pattern matching
I recently asked someone at work about how to take the output of ipcs -qa and make it space delimited, so I can parse it/store it in the database for monitoring. He gave me this:
ipcs -qa | sed 's/ [ ...
2
votes
2answers
52 views
How do I transfer multiple files with a common suffix and prefix using an offset?
I have thousands of files whose names are of the form:
sequence_1_0001.hmf
sequence_1_0002.hmf
sequence_1_0003.hmf
...
sequence_1_0001.jpg
sequence_1_0002.jpg
sequence_1_0003.jpg
...
...
3
votes
4answers
79 views
Recursively rename subdirectories that match a regex
I have a media server with a folder called Series. (/media/Expansion2/Series/)
In it, I have (surprise!) TV series. These are just the show names, e.g., /media/Expansion2/Series/The Big Bang Theory/
...
4
votes
4answers
114 views
How do I grep for multiple patterns?
I want to find all lines in several files that match one of two patterns. I tried to find the patterns I'm looking for by typing
grep (foo|bar) *.txt
but the shell interprets the | as a pipe and ...
3
votes
1answer
47 views
substituting third occurrence of a pattern using sed
Here is a sed command. I want to substitute third occurrence of 00 to 11
echo "0000000000000000" | sed -e 's/00/11/3'
The output is:
0000110000000000
But I thought output would be:
...
2
votes
2answers
57 views
regex replace text in xml file within node from the command line
I have an XML file and I would like to replace everything that is between the open and closing tag within multiple instances of the g:gtin node with nothing.
Is this possible from the command line, ...
2
votes
1answer
49 views
Delete repeated words between brackets inline
Our input looks something like
2012-04-17 [GBPGBP]
2012-04-13 [GBP GBP]
2012-04-13 [GBP]
2012-04-11 [GBPGBP]
2012-04-11 [GBP GBP]
2012-04-10 [GBPGBP]
2012-04-06 [GBP GBP GBP]
2012-04-17 ...
1
vote
1answer
36 views
Multiply certain numbers in a text -file by certain constant
I want an alternative solution to this jQuery hack, tasting a bit reinventing the wheel -- look I am sure I could do this with some one-liner using basic *ix tools. Look much easier and ...
1
vote
2answers
30 views
What is the usage of pattern before substitute command in sed
There is an example in this link about sed:
To delete the first number on all lines that start with a "#" use:
sed '/^#/ s/[0-9][0-9]*//'
What is the benefit of first pattern(/^#/)? It could be ...
1
vote
1answer
34 views
Substituting the first occurrence of a pattern in a line, for all the lines in a file with sed
Is it possible to do it in one liner?
I have an output like this:
"First line" - Description
" Second line" - Description
"Third line" - Description
" Fourth line" - Description
This input ...
3
votes
2answers
74 views
Find files starting with ~$ (MicroSoft Word Temp files)
For some reason my machine is full of M$ Word temporary files such as:
~$Filename.docx
~$AnotherFile.docx
Can someone suggest a find/regex command to search $HOME and delete them?
0
votes
1answer
48 views
Regular expresion ExpectJ
I've been used the ExpectJ library for java to automate some jobs on a linux server, however now I need to automate a job that send a text response different in each execution. Here is the output:
...