Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 7 years ago. Improve this question How to change file names from notation like this: SomeCodeFile.extension to C/C++ notation:
Tag: regex
How can I fix the following sed command?
I am trying to append _out to anything that matches the regex shown in the follwing sed command. The _out should be before the [ (]. The command returns the lines correctly as I expect. Now the problem comes when I try the following command where I define regions to use in the replacement. So for example if I have
Using regular expression search and replace rename on linux with directory creation
Take a list of files such as: I would like to rename these files and add some formatting similar to this: This would end up with the list of files looking like Up to here, this all works fine. The next step, and my real question is, how can I create a directory for each SubGroup in this process using
Using a pipe (or) in sed
From a variable $(JS_SOURCES) containing something like make writes a file containing mod1,othermodule. It works with this code: And my question is Why can’t I replace the 3 expressions with one using pipes ? The shorter sed command doesn’t trim the string (the purpose of two of the expressions). Why doesn’t it work ? How to fix that (without resorting
How do I copy regex matches from a file? Need to get all MAC addresses from log file
I have a linux dhcpd log that I need to get a list of only the MAC addresses. The MAC addresses are formatted like 00:ab:27:d8:dd:dd Using linux command line tools,parse INPUT file for MAC addresses and send to OUTPUT file. Where OUTPUT file is just a list of the MAC addresses, where then duplicate MAC addresses can be removed. I
Check for substring in Shell without Bashisms
I’m trying to write a shell script, and in it I have to look for the presence of -32 in a string. Unfortunately I have to do it without using any bashisms as it has to run on computers running Dash. I tried case ${1+”$@”} in *-32*);; but that will pick up something like -321. Is there a way to
How to remove commas in the middle of a specific line in a file in linux/unix
Someone was trying to be helpful in their test description. However, they added commas to the description so that when the test description is outputted to the log file, the results have extra commas. This makes it difficult to parse the results since the number of commas vary in the results file. I want to use sed and go into
How to grep a word inside xml files in a folder
I know I can use grep to find a word in all the files present in a folder like this But my current directory has many sub-directories and I just want to search in all xml files present in the current directory and its all sub directories. How can I do that ? I tried this But it searches for
How to rename all files in a folder removing everything after space character in linux?
Hello I can’t use well the regular expressions it’s all day I’m searching on Internet. I have a folder with many pictures: 50912000 Bicchiere.jpg 50913714 Sottobottiglia Bernini.jpg I’m using Mac OS X, but I can also try on a Ubuntu, I would like to make a script for bash to remove all the characters after the first space to have
Parse ps’ “etime” output and convert it into seconds
These are possible output formats for ps h -eo etime How to parse them into seconds? Please assume at least 3 digits for the days part as I don’t know how long it can be. The output will be egreped to one only line so no need for a loop. Answer With awk: Run with : Output: And finally, if