Search Results

Search: Posts Made By: Chubler_XL
355
Posted By Chubler_XL
On worries, it works like this. On first...
On worries, it works like this.

On first occurrence of an new $4 value ($4 in x) will be false so x[$4] is assigned to the record value.

On second occurrence $4 will be in x (we assigned it...
355
Posted By Chubler_XL
Try this: awk -F '\t' '{ if($4 in x){ print...
Try this:

awk -F '\t' '{ if($4 in x){ print (x[$4]?x[$4]"\n":"")$0;x[$4]=""} else x[$4]=$0}'

edit: or this
awk -F '\t' '{if($4 in x){if(x[$4]) print x[$4]; print;x[$4]=""} else x[$4]=$0}'
387
Posted By Chubler_XL
You don't want to match on -type d before the...
You don't want to match on -type d before the prune as the true condition negates the prune

I'd go with:

find / -path /u -prune -type f -o -name '*rpm*'
544
Posted By Chubler_XL
Is this what you are after? [[ "${counter}"...
Is this what you are after?

[[ "${counter}" -eq 3 && "${code}" = 'JP' ]] && nohup sh script.sh $val 1 &
473
Posted By Chubler_XL
It could be some sort of resource issue, or...
It could be some sort of resource issue, or connection limit. I'd try less threads.

With disk and network I/O bottlenecks involved, I find it hard to believe that 40 threads would be quicker...
989
Posted By Chubler_XL
This intent was to replace the original for loop...
This intent was to replace the original for loop like this:


DIR=/home/cmccabe/Desktop/new
for RDIR in "$DIR"/R_2019* ; do ## # matching "R_2019*" to operate on desired directory and expand
...
473
Posted By Chubler_XL
This seems to be working OK for me. I changed...
This seems to be working OK for me. I changed script as follows, so I could test in on local files:

#!/bin/bash

# SETUP OPTIONS
export SRCDIR="./test/sapdata*"
export...
475
Posted By Chubler_XL
Surely there are better ways to do this than...
Surely there are better ways to do this than changing your source with awk. If this is a once off change have a programmer use an editor.

If it varies a lot why not have another define variable...
989
Posted By Chubler_XL
Awk code uses blank line as record separator and...
Awk code uses blank line as record separator and new line as field separator. matching record that contains ref and then each field (line if record) is split and the 2nd word printed with spaces.
...
Forum: Shell Programming and Scripting 2 Weeks Ago
690
Posted By Chubler_XL
On Sun OS you need to use nawk or...
On Sun OS you need to use nawk or /usr/xpg4/bin/awk as the legacy Solaris awk is missing many POSIX features.
Forum: Shell Programming and Scripting 2 Weeks Ago
989
Posted By Chubler_XL
I believe you will need an awk script like this: ...
I believe you will need an awk script like this:

STRING=$(awk -F '\n' -v RS="" -v ref="$S5" '$0 ~ ref {d=split($0, val, " "); for(i=2;i<d;i+=2) printf "%s ",val[i]; printf "\n"}' "$DIR"/f1)
Forum: Shell Programming and Scripting 2 Weeks Ago
690
Posted By Chubler_XL
Glad to explain what is going on in this code. ...
Glad to explain what is going on in this code. Working thru and understanding is a great way to improve your awk skills.

Field separator RE [=\\][]

This is a simple bracket [] expression and...
Forum: Shell Programming and Scripting 2 Weeks Ago
193
Posted By Chubler_XL
With a slight change it should also work nicely...
With a slight change it should also work nicely for string data values:

$ echo ' wrongkey "some data"; key "more data";' |
awk 'match($0, /[ ;]key +"[^"]*" *-;/)...
Forum: Shell Programming and Scripting 2 Weeks Ago
989
Posted By Chubler_XL
Is this closer to what you need? ...
Is this closer to what you need?

DIR=/home/cmccbe/folder
for RDIR in "$DIR"/R_2019* ; do ## # matching "R_2019*" to operate on desired directory and expand
S5=${RDIR##*/} ## store run with...
Forum: Shell Programming and Scripting 2 Weeks Ago
989
Posted By Chubler_XL
I'm still a little confused on what you want to...
I'm still a little confused on what you want to happen.

You end up with variables as follows:
folders
00-1111-xxx-xxx/
00-2222-yyy-yy/

string
zzzz_0005 00-1111-xxx-xxx

You seem to imply...
Forum: Shell Programming and Scripting 2 Weeks Ago
690
Posted By Chubler_XL
And another awk approach: awk -v...
And another awk approach:

awk -v want="VALUE1,VALUE2,VALUE3" -F'[=\\][]' '
function prnsection(i) {
if(length(section)) {
printf "%s",section;
for(i=1;i in keypos;i++) {
...
Forum: Shell Programming and Scripting 2 Weeks Ago
1,873
Posted By Chubler_XL
&& and || control operators examine the exit...
&& and || control operators examine the exit status last command executed in the list.

If the last command has a zero exit status then a command following && will run:
$ [ 1 -eq 0 ]
$ echo $?...
Forum: Shell Programming and Scripting 2 Weeks Ago
1,873
Posted By Chubler_XL
I'd keep it simply with a case statement like in...
I'd keep it simply with a case statement like in post #41

send_multiple_payment(){
eval_send_amount
mk_json_object_one_val "$btc_amount_dec" "${addr_arr[@]}"
mk_json_lst_one_val...
Forum: Shell Programming and Scripting 2 Weeks Ago
634
Posted By Chubler_XL
Nice RudiC, if OP needs support for both double...
Nice RudiC, if OP needs support for both double and single quotes on call:

#!/bin/ksh
install_dir=${1//\\\\n/ }
install_dir=${install_dir//\\n/ }
printf "DIRR_PATH:%s\n" $install_dir
echo...
Forum: Shell Programming and Scripting 2 Weeks Ago
864
Posted By Chubler_XL
You could use a function to extract the required...
You could use a function to extract the required elements like this:

function splitarr {
local pos=0 word=0 items value i
local wrd=( $1 )
for items in $3
do
value=""
...
Forum: Shell Programming and Scripting 2 Weeks Ago
1,873
Posted By Chubler_XL
For readability and later extend-ability i'd...
For readability and later extend-ability i'd advocate an if then else construct:

if [ "$used_net" == "testnet" ]
then
btc_dec=$(bitcoin-cli -testnet getbalance)
else
...
Forum: Shell Programming and Scripting 2 Weeks Ago
989
Posted By Chubler_XL
STRING is empty. I believe this is because of /...
STRING is empty. I believe this is because of / character before and after ref variable:

$ echo "test" | awk 'match($0, /est/) { print $1 }'
test
$ echo "test" | awk -v ref=/est/ 'match($0,...
Forum: Red Hat 2 Weeks Ago
244
Posted By Chubler_XL
Could it be that the mount points on your root FS...
Could it be that the mount points on your root FS were populated with files so when you unmounted the disks the files under /ASM* in the root FS became visible.
Forum: Shell Programming and Scripting 2 Weeks Ago
651
Posted By Chubler_XL
you could use: grep -v -f Extracted.out ...
you could use:
grep -v -f Extracted.out Original.out

To get a list of lines in Original.out that don't appear in Extracted.out
Forum: Shell Programming and Scripting 3 Weeks Ago
989
Posted By Chubler_XL
You have a done statement on line 11 that doesn't...
You have a done statement on line 11 that doesn't match to anything.

S5=$(cut -d/ -f6 <<<"$TRIMSTR") ## store run with no path as S5
S5 will be empty because TRIMSTR doesn't contain 6 entries.
...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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