Search Results

Search: Posts Made By: rich@ardz
2,996
Posted By rich@ardz
AWK, Perl or Shell? Unique strings and their maximum values from 3 column data file
I have a file containing data like so:

2012-01-02 GREEN 4
2012-01-02 GREEN 6
2012-01-02 GREEN 7
2012-01-02 BLUE 4
2012-01-02 BLUE 3
2012-01-02 GREEN 4
2012-01-02 RED 4
2012-01-02 RED 8...
7,931
Posted By rich@ardz
Getting date -1 day not using GNU date
It's easy as pie to get the date minus one day on opensolaris:
date -d "-1 day" +"%Y%m%d"run this command on our crappy Solaris 10 machines however (which I'm guessing doesn't have GNU date running...
2,489
Posted By rich@ardz
creating a csv file from this 1 liner?
I'm trying to create a csv file by running awk and sed on a number of xml files in a directory; I'm using this below:

hostname; grep "BuildDate" /dir/ABCD/configuration/*/*.xml | awk -F"/" '{...
2,245
Posted By rich@ardz
awk -F'[ \t,_:.]*' '{print...
awk -F'[ \t,_:.]*' '{print $5","$9":"$10":"$11"."$12}' infilethat one returns:

richard@opensolaris:~/Shell$ awk -F'[ \t,_:.]*' '{print $5","$9":"$10":"$11"."$12}' junk.log
20101115,09:54:29.579...
2,245
Posted By rich@ardz
create csv in ksh from tricky log file
hi guys, trying to create a csv from a tricky log file in ksh,

using 'awk '{print $1" "$14" "$15" "$16" "$17" "$18" "$19}' >> $TMP_FILE' on another set of files I have an output file with...
3,593
Posted By rich@ardz
hi scrutinizer, just to clarify :) are you saying...
hi scrutinizer, just to clarify :) are you saying this:

sed 's/\(^\|[^[:alnum:]]\)\(rich\|RICH\|Rich\)\([^[:alnum:]]\|$\)/\1NICK\3/g' infile

will replace 'rich' with 'nick' or 'RICH' with...
3,593
Posted By rich@ardz
:cool: I won't even pretend i understand how this...
:cool: I won't even pretend i understand how this sed works! but it does! is it possible to replace uppercase with uppercase and lower with lower or would i have to run 2 different seds... cheers :b:
3,593
Posted By rich@ardz
input: hellorichhello HELLORICHHELLO ...
input:
hellorichhello
HELLORICHHELLO
SOMTHING-RICH-SOMTHING
SOMTHING@RICH
@RICH
RICH@
-RICH
RICH-
SOMTHING_RICH_SOMTHING
_RICH
RICH_
SOMTHING RICH SOMTHING
somthing rich somthing
...
3,593
Posted By rich@ardz
not quite what I was expecting :), My fault...
not quite what I was expecting :), My fault probably for not being clear enough with the requirement:

richard@opensolaris:~/share/cleaner$ echo "RICH_SOMTHING" | sed...
16,293
Posted By rich@ardz
use perl, example below to find files from the...
use perl, example below to find files from the last hour (not my code BTW) ;)

function SearchLogsLastHour
#This function returns a list of log files modified
#in the last hour using perl
{
cd...
3,593
Posted By rich@ardz
non alpha characters in sed + making it fast?
hello, I'm trying to write the fastest sed command possible (large files will be processed) to replace RICH with NICK in a file which looks like this (below) if the occurance of RICH is uppercase,...
6,474
Posted By rich@ardz
sed 's/JO[^ ]*\|jo/bo/' infile how do you...
sed 's/JO[^ ]*\|jo/bo/' infile

how do you modify this sed line to replace uppercase with uppercase and lowercase with lowercase?
5,436
Posted By rich@ardz
sweet :cool: mad skillz guys, mad skillz ...
sweet :cool:

mad skillz guys, mad skillz

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



how about error checking this example so if the...
5,436
Posted By rich@ardz
cheers guys, not really following though for...
cheers guys, not really following though

for i in $choice
do
echo "run function $i"
f${i}
done

how does that work if I hit the 1 and 2 key for example?

---------- Post updated at 02:14...
5,436
Posted By rich@ardz
They can just run one after the other, it's just...
They can just run one after the other, it's just a read:


read rSelection
if [[ $rSelection == '1' ]] then
#call function 1
else
if [[ $rSelection == '2' ]] then
#call...
5,436
Posted By rich@ardz
Shell script menu
hi guys, how would you do the following? I have a menu with 5 options in my shell script:

1. Run function 1 against files
2. Run function 2 against files
3. Run function 3 against files
4. Run...
1,592
Posted By rich@ardz
Shell scripting substitution techniques
Hi guys, I'm looking for some thoughts on this. I'm trying to do a clean 1 liner to substitute some values. What I have:

sed 's/Personid=.*/Personid=xxxxxx/' $tmpFileOut
sed...
6,474
Posted By rich@ardz
yeah noticed that before it's working now! what a...
yeah noticed that before it's working now! what a dumbass (me) :rolleyes:
6,474
Posted By rich@ardz
perl -pe...
perl -pe 's/(?<![a-z])jo(?![a-z])/bo/g;s(?<![a-z])tom(?![a-z])/bob/g' file

I just need to be able to specify multiple finds and replaces, the above does not work?

cheers!
6,474
Posted By rich@ardz
how do you string together multiple find and...
how do you string together multiple find and replaces, whenver I try and do it it only does the first one?
6,474
Posted By rich@ardz
is this able to differentiate between upper and...
is this able to differentiate between upper and lower case?
6,474
Posted By rich@ardz
Hell no! :D
Hell no! :D
6,474
Posted By rich@ardz
hmm, what I would like ideally is this (say I'm...
hmm, what I would like ideally is this (say I'm replacing JO with BO)

my file to run sed on looks like this (as an example):

akdjfdkl sdjfklsjdf jsdfkljsf JO KSJDFKDFJLJOdsjfskldjf dsjfkljsfl...
6,474
Posted By rich@ardz
hmm, that's not working the 'am' is still present...
hmm, that's not working the 'am' is still present in the file after it has ran? I have:

sed 's/^am$/jo/i' "$f" > "$f".tmp && cp -f "$f".tmp "$f" && rm "$f".tmp

Using OpenSolaris 10 btw, not...
6,474
Posted By rich@ardz
sed - replacing on the right of a pattern and looking for exact word?
how would you get SED to do the following, say you have the following lines in a text file:

user=tigger
some text some text
some text some text
some text some text
user=ted
some text some...
Showing results 1 to 25 of 52

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