Search Results

Search: Posts Made By: earnstaf
24,422
Posted By earnstaf
Put a space after the last number? egrep...
Put a space after the last number?

egrep "11.22.3 " file
5,742
Posted By earnstaf
I see how it is a bit confusing to use PORTCOUNT...
I see how it is a bit confusing to use PORTCOUNT as a variable when earlier I tried to use PORT$COUNT, but what I was trying to accomplish was to list each PORT$COUNT (PORT1 PORT2 PORT3, etc) all the...
5,742
Posted By earnstaf
Dynamic Variable Based on Count
I'm trying to assign variables that include the current value of a count, but I can't seem to get it working... this script is incomplete, but some guidance on how to use a dynamic variable would be...
4,550
Posted By earnstaf
find . -name "*" | xargs grep searchterm
find . -name "*" | xargs grep searchterm
8,608
Posted By earnstaf
So, I ended up making it work by taking the huge...
So, I ended up making it work by taking the huge string that the awk command output, pasting it into word and then doing a search and replace (replace name=* with \nname= ") However, I hate relying...
8,608
Posted By earnstaf
Edit: I used your code on a single record and it...
Edit: I used your code on a single record and it worked like a charm. Is there any way I can get that same output on multiple records?
Edit2: Disregard the below... I kept your RS=' ' the same and...
8,608
Posted By earnstaf
That is clever, but I don't know if it works for...
That is clever, but I don't know if it works for my situation, which is this:

I have a record that looks like:
acl add name=ACL_RULE_NAME pos=400 action=allow agent=proxy authneeded=no \...
8,608
Posted By earnstaf
grep -o would return just the match... so, if I...
grep -o would return just the match... so, if I entered:

> echo "this is a test" | grep -o test
> test
or
> echo "this is a test" | grep -o "this is"
> this is


whereas without the -o,...
8,608
Posted By earnstaf
Effects of grep -o when it's not available
I'm on a Solaris box that doesn't have -o as an option for grep (trying to return match only).

Is there any way to get this functionality without the -o option?

I've tried both sed and awk...
2,270
Posted By earnstaf
RegExp - settle a bet
A couple co-workers have a disagreement. Can you guys please settle this?

One co-worker says regular expressions can inherently search and replace. His argument is that he can do a s/ regexp /...
24,422
Posted By earnstaf
Maybe something like: egrep -v...
Maybe something like:

egrep -v "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[^54-61]" file


Not positive if that last part of the regexp works...
15
9,625
Posted By earnstaf
wc -l compare_output.dat | cut -d " " -f...
wc -l compare_output.dat | cut -d " " -f 1
7,207
Posted By earnstaf
Both the awk and perl versions work great......
Both the awk and perl versions work great... thanks guys.
6,143
Posted By earnstaf
So, I made a 1M line file and 10M line file to...
So, I made a 1M line file and 10M line file to test on... running the grep loop on a pretty beefy server (dual 2.8ghz intel xeons) and it took 170m ... so, not forever but definitely not as fast as...
7,207
Posted By earnstaf
Very nice radoulov... thanks for all your help. ...
Very nice radoulov... thanks for all your help. One final question: Can you think of any way to sort the records based on the output of count? Is it possible with awk? Sort can't do it due to my...
6,143
Posted By earnstaf
cat fileA | while read line do grep -q...
cat fileA | while read line
do
grep -q "$line" fileB
if [ $? -eq 1 ]; then
echo "$line" > fileC
fi
done


Not sure how fast that would be, but fileC will end up with all the lines that were...
4,114
Posted By earnstaf
That's a cool way to go about doing a hangman...
That's a cool way to go about doing a hangman type game. Should be pretty easy to have it pick a random dictionary word to use for $WORD and then give a certain number of guesses and decrement the...
7,207
Posted By earnstaf
otheus, This looks good and I see you have...
otheus,

This looks good and I see you have an output for "count" but I'm a little confused on how to use it in practice. The keys, in particular, is something I'm not familiar at all with. If we...
7,207
Posted By earnstaf
Thanks... the awk code seems to be doing the...
Thanks... the awk code seems to be doing the trick. Is there any way to count the # of instances of each record within awk?

Edit:
Found typo and got perl code working... Any way to count...
7,207
Posted By earnstaf
How to Sort Records Uniquely?
I have a file containing many records separated by a % that I would like to sort uniquely (and if possible with a count of dupes) while maintaining the integrity of each record.
File looks like...
6,884
Posted By earnstaf
for file in `ls folder_a` do cat $file |...
for file in `ls folder_a`
do
cat $file | while read line
do
grep -q $line folder_b/fixed.txt
if [ $? -eq 1 ]; then
echo "$file - $line not in fixed.txt"
echo "$line" >>...
12,226
Posted By earnstaf
You could do grep -c ...
You could do grep -c ...
3,763
Posted By earnstaf
I imagine you could just copy the name of the...
I imagine you could just copy the name of the directory then do

mv (paste folder name) newfoldername

In your case,

mv G^ran_F_080122 Goran_F_080122


Escape characters ( \ ) as necessary.
4,556
Posted By earnstaf
Correct me if I'm wrong, but I think he is wanted...
Correct me if I'm wrong, but I think he is wanted the month to be the 3 letter month, such as Jan, Feb, Mar, etc (dd-mmm-yyyy.)

I'm having some trouble figuring how to find the date in the file...
9,478
Posted By earnstaf
Not quite as neat or clean as the awk example,...
Not quite as neat or clean as the awk example, but perhaps useful if the field changes:

egrep -o "[a-z0-9]{2}:[a-z0-9]{2}:[a-z0-9]{2}:[a-z0-9]{2}:[a-z0-9]{2}:[a-z0-9]{2}" filename
Showing results 1 to 25 of 111

 
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy