General :: Which Regex Standard Is Used In Grep?
Apr 12, 2011I'm wondering if it's POSIX + ASCII or something else is mixed in?
View 1 RepliesI'm wondering if it's POSIX + ASCII or something else is mixed in?
View 1 RepliesI'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash
for i in $(ls -d /Users/*)
doif [ -e $i/.tcshrc ]
thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"
[code]....
At my work i have a legacy web system that tells the id of documents based on some given variables. this information can be used in another system to retrieve the needed file.
I am trying to automate this, and have managed to feed the variables and download the correct page using wget. The result is a result.php page with a lot of embedded info.
The information i am looking for is enclosed in single quotes on a line like this:
The information i want is the 1234 part.
I thought i could do like this from bash:
But I always get an empty string back... any idea what i am doing wrong?
regex in grep? I need to match ANYTHING in the following with any character combination (something like * in findstr in C): grep "Delivery of nonspam" /var/log/mail.log | grep "to [URL]"
View 1 Replies View RelatedI have a data file with the following format 0 i j # # # # with other random lines of text to be filtered out.The following script works when there aren't many #s, but it shuffles long lists of data.
/^0/ {
split($0,token)
printf("%s %s ", $2, $3)
[code]...
I am not a big skype user, but I was chatting with my sister, made a typo and habitually typed
tpyo
s/tpyo/typo/
to my surprise it actually changed the history. I am using the linux skype client 2.1.0.47-r1 and my sister is using 4.something on windows.
When she tried to do the same thing, it didn't work. Does anyone know if this is specific to the linux version?
sometimes there are one, sometime there are two exchanges in this log file. the 100= is the stock exchange- if there are two, they are seperated by a comma. i understand how to escape a comma in a regex, but I am having trouble with combining it.
35=8 39=1 38=1000 32=13 14=754 31=1.11 44=1.1 100=AMEX,ISE
35=8 39=1 38=1000 32=151 14=205 31=1.1 44=1.1 100=AMEX
35=U 39=2 38=1000 32=45 14=184 31=1.1 44=1.1 100=AMEX,ISE
[code]...
I have some lines of text and I want to detect words that meet some criteria with sed.
E.g. The line "tetris cat dog test cactus stereotype"
I want to detect the word that contains two (2) ore more t letters. That mean the words tetris, test and stereotype.
The following regex doesn't do the job because it can;t distinguish words very well.
I thinks I have ti incorporate something like [^ ] in the regex but I wasn't successful...
I have a ton of files that are timestamped directories. These all look like2011-06-24_13.53.36 // a directory name for june 24th, 1:53:36 pmI have thousands of these directories. I want to do operations on some of the older ones. Let's say I give it a string for date time that matches that exact format, like i'll give it2011-06-25_00.00.00 // june 25th, 12amI want to find all the directories BEFORE my time. So if i give the string for 12am on june 25th, i want to find all the directories before then.If not i can find EVERY directory i have like this and then filter after wards. The created/modified dates are not tied to the actual timestamp im looking for (that would make this easier)
View 2 Replies View Relatedi am trying to find all 3 and 4-character length words in my file (which is huge and has alot of entries in it, a big fat wordlist!).My attempt with this regular expression (which I thought should work, found something on length search here: [URL]
cat sorted_noapostrophe.txt| grep '.{3,4}'
but it returns no results? Also to find any words starting with 'f' which are between 3 and 5 characters (inclusive) long, how can this be done?
I'm fairly comfortable with emacs but I can't seem to find how to do this. I deal with a lot of text files and find myself performing a lot of regular expression replacements to correct the formatting of the text -- or to extract certain tidbits of data from large ugly-looking files.
I know how to perform a regular expression replacement in one buffer at a time. But how do you perform a regular expression search and replace across all open buffers? I have found a method to perform a regex search and replace across a directory by marking files but I need to do it in the open buffers.
I use the Actions feature of KDE's Klipper utility to run certain commands when I copy something into the clipboard that matches a particular regular expression. Unfortunately, I have to turn on Enable Clipboard Actions and select the command from a menu every time I copy something that I want to run the command on. I'd like to have that command run automatically instead.
You'd think this was possible, as there is an automatic checkbox in the action settings dialog box:
Unfortunately, that appears to do nothing. The documentation included with Klipper does not indicate what that checkbox is supposed to do.
Is it possible to configure Klipper to run a command automatically if the contents of the clipboard matches a regular expression? If not, is there another way to accomplish this?
I am tryng to get values BBA 204- BBA 324 from a log file.
this is my script:
zmore log.gz | perl -nle 'print for m/BBAs[2|3][0-9][0-4]/g' | sort -u | perl -ne 'print if /^BBAs204$/../^BBAs324$/'
the first perl one liner gives me everything from BBA 200 to BBA 394, and the second perl one liner cuts it down to BBA 204 to BBA 324
Is there a elegant regex that will allow me to skip the second perl one liner and just take out the BBA 204 - BBA 324
I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?
View 3 Replies View RelatedI need to kind of grep within grep. My input file would be something like:
[Code]....
and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:
[Code]....
I'd like to print only few groups from text matching a regex. How can I do that in the Linux command line?
What other tools for text processing are there in Linux?
I have a crontab that wgets a PHP page every five minutes (just to run some the PHP code), and I want to send the output to /dev/null. I couldn't find it in the wget manual.
I'm looking for something like:
wget -o stout http://whatever.com/page.php > /dev/null
I ran into an issue that was written up here on LQ and/or on other sites, the one dealing with an error similar to the following one: error trying to exec 'cc1plus': execvp: No such file or directoryThe solution seems is to make g++ and gcc versions consistent. I've since remedied that, but am slightly confused with my findings and concerned with my solution.
When I first looked in /usr/bin for all references to g++ and gcc, I saw that there were two version of gcc and one version of g++:
(Note the "??? ?? ????" as date for gcc. I've since made some changes, but this was essentially the set of gcc and g++ files that existed before I started.)
I'm told that the system I'm using is an "out of the box" installation, i.e. no modifications. As installed, gcc is the newer version and does not correspond to g++34:
Confusion and concern: When I use makefiles from software I've adopted, I run into the cc1plus problem eluded to above. The cc1plus error occurred because the makefiles expected there to be a command named "g++," so I created a symbolic link, pointing /usr/bin/g++ -> /usr/bin/g++34. And in doing so, g++ was not consistent with gcc. I've since fixed that, i.e. copied the gcc34 version to gcc and my software builds fine.
My question are:
1. Will copying the gcc34 version to gcc cause issues in the future, possibly related to upgrades and/or istallations of other packages that rely on "gcc"? Currently the files are as follows:
2. Were the g++ and gcc files in /usr/bin the "out of the box" versions?
3. How can I answer a question like this in the future, without posting to LQ, i.e. is there a reference to find this type of information?
Is there some sort of standards file path convention for installing softwares that I could follow through? For example, I just learnt how to build Nginx from source. But the default binary path set by nginx is "/usr/local/nginx/sbin". I have seen a couple of tutorials which they specify the location of the installed binary and it is very different from those usual default paths. Thus, got me thinking whether is there some form of file path convention that I should follow?Is there some kind of list which states where do those packages on Debian.org Repository usually installed to?
View 6 Replies View Related[1st off...I used to host my music (A&R) website on a dedicated windows server...'cause I thought it was necessary for streaming .wma files. when I discovered it wasn't...I went w/ a standard hosting package, w/ GoDaddy...
BUT...
I moved my recording studio's site to it's own domain. [it used to be a series of pages on my A&R site.]
I now need to create a '301 Redirect' in my old site's directory to redirect surfers (who have my old url) to the new site...but more importantly...to retain my ranking w/ the major search engines...!
It cannot be done on a Windows server (which I'm on, w/ GoDaddy)...not an .htm redirect anyway, which I need. I've tried all the php, asp, etc. scripts...they don't work. [&...I don't think I really need windows features like php or asp...I code my site(s) in Dreamweaver as html pages.]
so...If I migrate my site(s) to a Linux server...
1) Will standard .wma streaming continue to work...? (i.e., a .wax file in the directory that points to the .wma).
2) Which type of server is FASTER for this task...(if any)...Linux or Windows...?
I'm trying to set the time in an embedded system ... There isn't a link/file /etc/localtime and /usr/ has only two subdirectories /usr/bin and /usr/sbin.Is there something I can try or do I just give up and make UTC be my timezone?
View 2 Replies View RelatedI am using Red Hat Enterprise Version 5. There is a ruby program which use standard input as its input (e.g. the Ruby program process input from standard input). I think standard input should be keyboard, correct?
So, I think other kinds of input (non-standard input) should not work (i.e. the ruby program should not be able to read input from such non-standard input), but actually I have tried using pipe works, I am so confused because I think pipe should be some other kinds of input -- other than standard input, why it could work? i.e. put text "123" in abc.txt with pipe, could achieve the same result as using keyboard as input to type "123" for the ruby program.
cat abc.txt | ~/test/rubysrc/foo.rb
I'm working on a SBC9261 board with touchscreen, running Linux 2.6.24./dev/ttyS0 is the standard output and /dev/tty0 is the console on the touchscreen.What I would like to do is to clone the standard output to the touchscreen, so the console would be displayed twice.
It would be like :
Code:
~ $ ./whatEverScript > /dev/tty0
but the output would also appear on /dev/ttyS0.
What I want to do is to find keyword in config file and change its value - that must be done using script.
I could write script usig awk and etc - but maybe there are already prepared ways/commands to change standard configure file setting?
I was wondering if there is an argument I can pass to the configuration file to have it use a library from a non-standard path to compile with - for example I would like it to use my perl located in /scratchbox/users/jeff91/usr/bin/perl instead of the standard /usr/bin/perl
View 3 Replies View RelatedI came across term as "standard root password control application"
I have no imformation over what are such applications how to implement them?
It was also suggested to audit root login .How would i go about it?
I need to find file from ls - l by using grep and certain regexp.
In particular I need greep to see certain file ending, like let's say .txt but only using regex.
So it should be something like
ls -l | grep '^.+.txt$'
But that doesn't seem to work for me.
I am basically very new to linux.. I have rhel 5.2 sever. while the system booting the following error had shown.
touch: can't touch '/var/lib/random-seed ; No such file or directory
chmod; can't access'/var/lib/random-seed ; No such file or directory
touch; can't touch '/var/log/wtmp ; No such file or directory
chgrp; can't access '/var/run/utmp; No such file or directory
[code]....
I need to grep a dictionary file.Only the words that contain 2 or more z's and only 1 b needs to be listed.
View 1 Replies View RelatedI am trying to grep for A records in a bind zone file but I am failing.I am trying: grep "s+As+" db.domain.comBut there are no results.
View 12 Replies View Related