1
vote
1answer
25 views

Is it possible to sed -i from a text file to another text file?

I'm coding a shell script on my Debian box and there's a line on the script that needs to delete some emails from a textfile that is full of emails, like this: sed -i ...
0
votes
4answers
277 views

Regular expression to find senders IP using grep or other languages

I have input file that contains: 19:04:01.631948 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 48) 181.173.82.61.1985 > 250.66.33.195.1985: HSRPv0-hello 20: ...
0
votes
6answers
637 views

grep *.c not working

I have a list of ".c" (c files) in the current directory. I have to find all the .c files in the current directory. The command that can be used id ls *.c But, another way is to use grep. so if i ...
4
votes
4answers
5k views

rsync using regex to include only some files

I am trying to run rsync to copy some files recursively down a path based on their file name pattern, case insensitive. This is what I have done to run rsync: $ rsync -avvz --include ='*/' ...
0
votes
3answers
426 views

Parse and remove parts of strings between delimiters

I would like to go through a file and remove certain sequences in between delimiters. For example drw---- 00000000 11111111 0 ./a/ drw---- 00000000 11111111 0 ./b/ d------ 00000000 ...
0
votes
1answer
534 views

How to insert thousand separator with `sed`?

I want to insert thousand separator into a number sequence with sed and this ugly RE sed -e :a -e 's/\(.*[0-9]\)\(\([0-9]\{3\}\)\(,[0-9]\{3\}\)*\(\.[0-9]*\)\)/\1,\2/;ta' [filename]. Is there a more ...
0
votes
1answer
430 views

Sed pattern for multiple lines

I want to remove all create table statements from a mysql script, but the statement runs over multiple lines. Like this: Create table ......NEWLINE... NEWLINE... NEWLINE....; So I tried this ...
0
votes
1answer
181 views

seq with regex, error message for mysql quotes

Is there some tool that auto quotes regex for seq? I can't figure out what I'm doing wrong. I always get this error unterminateds' command` sed -i 's/INSERT INTO `tablename.*`/INSERT INTO ...
3
votes
2answers
446 views

sed: Replace an unknown number of patterns on the same line

I'm trying to use sed to search for a certain 'primary' pattern that may exist on several lines, with each primary pattern followed by an --unknown-- number of 'secondary' patterns. The lines ...
4
votes
1answer
1k views

How to install regexp enabled 'rename' on fedora?

I have a batch rename task and I find the 'rename' command in Ubuntu and Fedora is different. In Ubuntu, rename is written in Perl and has regexp support. Is there anyway to install it on Fedora?
8
votes
9answers
6k views

How do I copy file named starting with a dot?

I am trying to copy all files under directory A to directory B. All files under directory A are starting with dot, for example: A/.a A/.b A/.c which I found if I use: cp A/* B, always get error: ...
3
votes
1answer
812 views

How to use regex quantifiers to rename multiple files with zmv?

I have the following files in a single directory: 1-1 - different text for each file here.txt 1-2 - different text for each file here.txt . . 1-9 - different text for each file here.txt 1-10 - ...
5
votes
3answers
16k views

How to delete files on the command line with regular expressions?

Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, ...
0
votes
1answer
548 views

Replace filename with filepath with sed

I want to replace the string /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib/cucumber.rb with the string /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib/ on the command line, probably ...