Search Results

Search: Posts Made By: KidCactus
1,569
Posted By KidCactus
That solved my issue, thanks! :) ----------...
That solved my issue, thanks! :)

---------- Post updated at 03:02 PM ---------- Previous update was at 03:01 PM ----------


No they don't, but thanks for the input. :b:
1,569
Posted By KidCactus
sed script to parse logs issue
I have this script to parse some logs:

#!/bin/bash
id=$1
shift
sed "/(id=$id)/,/^$/!d" "$@"

Usage: ./script.sh 1234 logfile

The logs have an empty line before the logged events/timestamps...
8,165
Posted By KidCactus
Ah, nice. :)
Ah, nice. :)
8,165
Posted By KidCactus
Thanks, that works like a charm. :) What does...
Thanks, that works like a charm. :) What does shift do?
8,165
Posted By KidCactus
Sorry, that could be described a bit better, yes....
Sorry, that could be described a bit better, yes.

What if I would want to do this in a script:

grep string file*

This would obviously not work then, as it would only grep in one file?...
8,165
Posted By KidCactus
What if would do kind of the same thing but with...
What if would do kind of the same thing but with grep, where I would use multiple arguments, and still wanted to use wildcard for the filenames?
8,165
Posted By KidCactus
I assume I could get that into a for loop...?
I assume I could get that into a for loop...?
8,165
Posted By KidCactus
Wildcards in file input to a script?
I have four files:

test
test2
test3
test4

I have this simple script:

#!/bin/bash
ls $1

Why does ./the_script.sh test* only list the first file, when a normal ls test* would list all...
1,106
Posted By KidCactus
Thank you for the quick reply, and yes, that did...
Thank you for the quick reply, and yes, that did the trick. Much appreciated. :)

---------- Post updated at 06:33 PM ---------- Previous update was at 06:00 PM ----------

And if I want to be...
1,106
Posted By KidCactus
Simple sed script question
Script newbie, so I'm sure I'm missing something obvious here, but how come this simple script does not work?

#!/bin/bash ...
1,751
Posted By KidCactus
Thanks, I will try that. :)
Thanks, I will try that. :)
9,123
Posted By KidCactus
Yes that seems to do the job perfectly. :) Thank...
Yes that seems to do the job perfectly. :) Thank you so much for taking your time to do this, I appreciate it a lot.
9,123
Posted By KidCactus
Thanks! How would I use that outside a script?
Thanks! How would I use that outside a script?
9,123
Posted By KidCactus
That is already corrected, see my last post.
That is already corrected, see my last post.
9,123
Posted By KidCactus
Aaah, good catch! :wall: That seems to have...
Aaah, good catch! :wall:

That seems to have fixed it, now I think it's all good. Thanks everyone! :)

Edit: Nope, it didn't. :( I still have some strange sorting. I think it occurs when the day...
9,123
Posted By KidCactus
Now I'm running this, which still give me a...
Now I'm running this, which still give me a result which aren't really sorted:

perl -ne'BEGIN {
@m{
qw[ jan feb mar apr maj jun jul aug sep oct nov dec ]
} = 0 .. 11;
}
do {
...
9,123
Posted By KidCactus
Ja det är de. Yes they are. But I've changed that...
Ja det är de. Yes they are. But I've changed that in the script also, it's only May/Maj that is different.
9,123
Posted By KidCactus
I must have missed something, now I get it to run...
I must have missed something, now I get it to run through it at least. But it doesn't seem to sort it as it should.

For example, I get this:



Those two posts from 2007 should obviously not...
9,123
Posted By KidCactus
Thanks. I do get an error when I execute the...
Thanks.

I do get an error when I execute the script though:



I use the filename output.txt as infile.
1,751
Posted By KidCactus
Remove whitespaces in the n first characters?
I assume removing whitespaces in the n first characters of a string would be an easy task for sed? If so, how?
9,123
Posted By KidCactus
They are part of the input.
They are part of the input.
9,123
Posted By KidCactus
Sort content of text file based on date?
I now have a 230,000+ lines long text file formatted in segments like this:



Is there a way to sort this file to have everything in chronological order, based on the date and time in the text?...
916
Posted By KidCactus
Thanks, but I can't get that to work, I get the...
Thanks, but I can't get that to work, I get the same result as in my first post.

Edit: Sorry, you are correct, that worked like a charm! I checked the wrong output file. :o
916
Posted By KidCactus
Replace pattern with deleted line?
If I have this:

perl -pne 's/img_onload.{8}//g'

How would I do to instead of replacing img_onload.{8} with "nothing", get "nothing" to be a deleted line? Kind of the opposite to \n.
3,273
Posted By KidCactus
Dirty or not, I piped the first one to the second...
Dirty or not, I piped the first one to the second one, and it works like a charm! :b: Thank you so much.

---------- Post updated at 10:38 PM ---------- Previous update was at 02:53 PM ----------
...
Showing results 1 to 25 of 33

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