Thanks @bakunin
I think this
will work although this will also take spaces into consideration ,as I am not aware if those were to be ignored or not
Please let me know if I have missed something or there are any other more simpler approaches as I will be very pleased to learn about it too
I think this
will work although this will also take spaces into consideration ,as I am not aware if those were to be ignored or not
Please let me know if I have missed something or there are any other more simpler approaches as I will be very pleased to learn about it too
I think spaces are characters like any other. The important point in such problems is not to do it this way or that way (like including the spaces or not), but to be aware of the limitations of ones solution. As you are aware that your solution only works under a narrowly defined set of definitions your take is impeccable.
One little problem remains, though: you seem to have developed this with a GNU-grep. GNU-grep - like other regexp-based GNU programs (i.e. sed) uses GNU-BREs (Basic Regular Expressions), which are slightly different from POSIX-BREs. In this case, you specifically use the "+" quantor, which means "1 or more". In POSIX-BREs this quantor doesn't exist, only the "*", which means "0 or more". If you want to be portable across different Unix-flavours you should write the regexp this way:
which does the same as yours.
Second, it is debatable if 0 is an even number. This is a matter of definition, though, so if you define 0 to be even you should replace "+" with "*".
Hi,
New to scripting and looking for some help.
I am trying to write a script that will search a specified directory for any new or modified files within the last 7 days and display the results. This will be ran daily and emailed?
Thanks (18 Replies)
Hallo gentlemen,
i've a problem removing lines from txt file. To make it simple, here is an example:
TEXT1.TXT --- contents:
9.9.9.9 geek.net
1.1.1.1 geek.com
2.2.2.2 leet.net
TEXT2.TXT --- contents:
geek.com
coolbar.org
I simply do:
cat text1.txt | grep -f text2.txt >... (7 Replies)
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Hello,
I have a command and would like to make that as a script. How do I do that?
my command is:
grep -Eo +\.+\.+\.+.
and i want to have that like grepscript.sh x.txt > IP.txt
Can somebody help me? (3 Replies)
Hi
i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it,
this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts.
Here is my script
#!/bin/csh -f
source .orapass
set user = $USER
set pass = $PASS
cd /opt/data/scripts
echo... (2 Replies)
Hi.
I am trying to extract the output of the first few lines of a continuos sh script.
The when i run it, i wont to grep the the first 20 lines of it for an entry and basically do a crtl z out of it or to that effect, and output the results to a text file.
I basically want to script... (5 Replies)
Hi,
I am new to this - I have a unix command (below) that I would like to make automated. I would like the script to run the below command line but would like user input for '\' and '\' as these values will change depending on what i'm searching for. Is this possible? if so please help.
... (13 Replies)
hi guys,
i was hoping you could help me out with the following
im designing a help site for my work colleagues and would like a little script which would do a grep to check if an application is running on unix
for example this is what i do on unix
ps -ef | grep mqm
and this tells me if... (4 Replies)
This is an extract from a script that i am trying to run.
for tim in "2005:00:" "2005:01:" "2005:02:" "2005:03:" "2005:04:" "2005:05:"; do
FormString="$tim"
echo "grep '$FormString' access.10Aug-1201AM"
count=`grep "$FormString" access.10Aug-1201AM | wc -l`
... (1 Reply)