Search Results

Search: Posts Made By: jack.bauer
2,224
Posted By jack.bauer
second one works. only thing missing is ability...
second one works. only thing missing is ability to tell it what field you want to return by supplying the field name not the field position i.e

match merk, return make model
or
match merk,...
2,224
Posted By jack.bauer
thanks but this wont return the headers "make,...
thanks but this wont return the headers "make, value"
2,224
Posted By jack.bauer
Combined sed+awk for lookup csv file
have written a combined sed+awk to perform a lookup operation which works but looking to enhance it.

looking to match a record using any of the comma separated values + return selected fields from...
1,999
Posted By jack.bauer
works, thanks. had to tweak a little though ...
works, thanks. had to tweak a little though

awk '/Name.foo/,/64bit/ {if($0 ~ "<64bit>false<\/64bit>") $0="<64bit>true<\/64bit>";print}' clients.xml


also came up with this that equally works
...
1,999
Posted By jack.bauer
Match pattern1 in file, match pattern2, substitute value1 in line
not getting anywhere with this

an xml file contains multiple clients set up with same tags, different values.

I need to parse the file for client foo, and change the value of tag "64bit" from...
2,095
Posted By jack.bauer
cool that works. although first i thought you...
cool that works. although first i thought you made an error with "st" = "OK" so i tried NOTOK first. i.e if the result of the previous cmd was not ok then report failure. but that didnt work, your...
2,095
Posted By jack.bauer
Test exit status of last cmd via ssh
see below for a housekeeping script which constructs an ssh cmd using some server/path/sudo info found in $HRINST.
the script should hop to each server and if it finds a file to cleanup, moves it...
1,116
Posted By jack.bauer
Combine these two into one liner awk?
ignore the simplicity of the foo file, my actual file is much more hardcore but this should give you the jist of it. need to combine the two awks into one liner. essentially, need to return the value...
7,423
Posted By jack.bauer
Hi Jim thanks for the response I found a way to...
Hi Jim thanks for the response
I found a way to do this via ssh, see my edit above.
The only outstanding part is being able to cd into a directory passed as a parameter in the ssh -t command
7,423
Posted By jack.bauer
1. yes 2. there is a powerbroker group that...
1. yes
2. there is a powerbroker group that they can sudo into but currently they are sudo'ing into the service account via ssh
3. the user will lose their own custom profile that they would have...
7,423
Posted By jack.bauer
ssh & load custom profile
i've created a custom profile that contains custom functions and alias' etc...

it's called .jason_profile

currently we ssh to the server then load the profile manually from the cmd line i.e
...
2,476
Posted By jack.bauer
found my first little "bug" with this, more like...
found my first little "bug" with this, more like "shortcoming" as i didnt plan for it.
if file one has field1 appearing more than once (on a separate line), i would need that in the output with its...
2,431
Posted By jack.bauer
is yesterday a shell variable? I'm scripting in...
is yesterday a shell variable? I'm scripting in ksh and executing under bash
UPDATE: ignore, i see this is ksh
2,431
Posted By jack.bauer
yesterday's "weekday" date
i've been going through https://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html to find a cmd that will print me yesterday's date. I have found one that does...
1,242
Posted By jack.bauer
thanks. yes it is strange in its current...
thanks.

yes it is strange in its current form, I had to tweak it as i was only feeding the header.
1,242
Posted By jack.bauer
Explain this awk
found this handy one liner in another thread which is closed, it does what i need but im trying to understand it. it basically matches the field that contains the value v and prints its position
...
19,648
Posted By jack.bauer
thanks otheus, very well explained. one question...
thanks otheus, very well explained. one question though. "and if the value is not null or not blank"

which bit is doing the above validation?
2,476
Posted By jack.bauer
understood, thanks. speaking of making the...
understood, thanks.

speaking of making the code for efficient, the current method will become expensive soon as file 2 will grow to thousands of lines whereas file1 will only be around 20-30...
2,476
Posted By jack.bauer
Ok I'm with you now. That means when I load...
Ok I'm with you now.
That means when I load field 1 into the array, I've actually created an empty array element with my values from field 1 as index.
I was under the impression they are actually...
2,476
Posted By jack.bauer
sorry still a little confused. so the...
sorry still a little confused.

so the sequence is:
1. load file1, field1 into arr until FNR==NR
2. perform the match condition i.e $3 in arr

at this point my array still contains the value...
2,476
Posted By jack.bauer
indeed that works, thanks. do you mind...
indeed that works, thanks.
do you mind explaining this {arr[$1]=$2
and OFS=, at the end (as i thought the comma within the print brackets did the job)
2,476
Posted By jack.bauer
Simple two file compare with twist
I have file1 and file2
I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2.
I now want to add field2 of file1 in the output.

I suspect what I...
19,648
Posted By jack.bauer
would you be able to break this down pls so i can...
would you be able to break this down pls so i can understand how it's achieving the result? I have a similar problem and i think i should be able to tweak this if i can understand it. thanks
4,774
Posted By jack.bauer
makes sense. enhancing it further to allow user...
makes sense. enhancing it further to allow user to provide a path for the target file. was pretty simple and got that working.

echo 'enter full path to eodfeed file'
read targetpath
echo...
4,774
Posted By jack.bauer
interesting. how comes the former doesnt print on...
interesting. how comes the former doesnt print on screen first despite the print $0?

having trouble reading back the red bit. what are we doing here?
Showing results 1 to 25 of 30

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