Search Results

Search: Posts Made By: RudiC
Forum: Shell Programming and Scripting 16 Hours Ago
151
Posted By Aia
Hi Lord Spectre Please, review how you have...
Hi Lord Spectre

Please, review how you have executed the code from post #4. Based on your input it should have given you the desired output instead of no output as you mentioned.

Here's another...
163
Posted By nezabudka
Hi Maybe this will help? ss -t -o state...
Hi
Maybe this will help?
ss -t -o state established

--- Post updated at 16:07 ---

ss -t -o state connected
ss -t -o state synchronized
371
Posted By MadeInGermany
Can be done as a { } group. (Note: there must be...
Can be done as a { } group. (Note: there must be a semicolon or newline before the closing brace! And of cause spaces next to the [ ] { } )
if [ -f ./file2 ] && [ -f ./file3 ] && { [ -f ./file1 ]...
348
Posted By rbatte1
One line sed option
How about using a single line sed like this:-sed "s/^C\( CALL.*'\(Gmax\|Gmin\|HS10\|HS2\|HS9\|Hmax\)'.*\)/\1/" source_file_name > target_file_name

It's a little messy to read, so:-

The s...
340
Posted By rbatte1
This is telling you that the value for pday is...
This is telling you that the value for pday is not set or not an integer, so your command as a whole becomes invalid. Could you sh -xv rmAgingFile.sh file*.log 2 and review the output to see what is...
440
Posted By vgersh99
be careful... some awk's don't have NR available...
be careful... some awk's don't have NR available in the END block. Just reassign NR to nr in your "main" block and use it in the END.
844
Posted By rbatte1
From my suggestion in post 5, I'm sure you can...
From my suggestion in post 5, I'm sure you can attempt to replace the sub-process on line 2 (the bit between $( and )) such that the output it creates uses a loop based on a counter to create the...
844
Posted By rbatte1
Do you want something more like:printf --...
Do you want something more like:printf -- "/path/to/xxx.py \\\\\n%s\n\t--ref /path/to/file \\\\\n\t--run /path/to/data\n" \ # Set up the output format with fixed strings and an...
758
Posted By Chubler_XL
You could you an awk script like this: awk...
You could you an awk script like this:

awk -F$'\t' '
NR>1 {
H=H OFS $2
V=$3
$0=$1
$NR=V
L[NR] = $0
}
END {
print "Date_Time" H
for(i=2; i in L; i++) print L[i]
...
152
Posted By vgersh99
if you need to "fold" the lines at 60 char width,...
if you need to "fold" the lines at 60 char width, pipe the output to fold:
awk .... | fold -w 60
815
Posted By vgersh99
first off: #!/bin/ksh secondly, where do you...
first off: #!/bin/ksh
secondly, where do you expect your DAS_VetFed.txt file to be? Looks like the working dir where the script was invoked from.
But then I see:
dir=/mydirectory
cd $dir
So I'd...
881
Posted By rbatte1
Does the output from last show you who (and where...
Does the output from last show you who (and where from) people were logged in at that time? Look especially for lines that say down in them.

Does that help you?


It might help in future if...
1,264
Posted By Chubler_XL
RudiC although your replace works for ~/dir/path...
RudiC although your replace works for ~/dir/path it would not work for ~root/data/mydatafile or /home/dba/data~files/myarray.dat.
The function in post #7 supplies a more accurate expansion.
1,264
Posted By Chubler_XL
The problem is ~ is not being expanded. It turns...
The problem is ~ is not being expanded. It turns out to be a little tricky to expand ~ but also avoid word separation on the path name (white spaces in you array source filename).

Try:function...
822
Posted By MadeInGermany
Include the existing trailing spaces in order to...
Include the existing trailing spaces in order to replace(=remove) them:
s/ID3 */$NEW${SPC:${#NEW}}/
A variant with printf:
sed -i "s/ID3 */$(printf "%-10s" "$NEW")/" TESTFILE_TEST
1,176
Posted By nezabudka
awk -F'<<|>>' '{while((getline d<$2) >...
awk -F'<<|>>' '{while((getline d<$2) > 0){while((getline b<$4) > 0) print $1 d $3 b $4; close($4)}}'
1,098
Posted By Scrutinizer
Try: awk ' NR==FNR { ...
Try:

awk '
NR==FNR { # When reading the first file (then NR is equal to FNR)
A[$1]=$0 # Store the first file...
552
Posted By MadeInGermany
The echo $a1 | ssh ... redirects stdin - but...
The echo $a1 | ssh ... redirects stdin - but nothing reads from it.
You can just redirect stdin with </dev/null ssh ... or close stdin with ssh -n ...; that should have the same effect and not...
800
Posted By vgersh99
Strange... Given your sample input in post#1...
Strange...
Given your sample input in post#1 and using RudiC's code, I get:

{"NAME":"QLogic 570x/571x Gigabit Ethernet Driver",
"VERSION":"11.11,REV=2009.11.11",
"BASEDIR":"/"}
{"NAME":"QLogic...
2,381
Posted By Scrutinizer
Hi, try: join -t \| -a 1 -a 2 -e 'NULL' -o 0...
Hi, try:
join -t \| -a 1 -a 2 -e 'NULL' -o 0 1.2 1.3 1.4 2.2 2.3 2.4 \
<(join -t \| -a 1 -a 2 -e 'NULL' -o 0 1.2 2.2 2.3 file1 file2) file3
2,908
Posted By wisecracker
Perhaps because the OP might mistake '1' as being...
Perhaps because the OP might mistake '1' as being a result or a '$?' as opposed to a 'true'.
(Also it does not work in POSIX but that is my reason not the OP's.)
2,143
Posted By MadeInGermany
Attention: ssh -qn is ssh -q -n where -n...
Attention:
ssh -qn is ssh -q -n where -n inhibits reading from stdin - good for ssh -q -n remotehost remotecommand. But it must be ssh -q remotehost < file and ssh -q remotehost << heredoc and ...
971
Posted By rbatte1
If you have them in a file, how about:-cut -f-3...
If you have them in a file, how about:-cut -f-3 -d"." input|sort|uniq -cWould that do? It's not quite the pretty output, but you get the detail you need.



I hope that this helps,
Robin
2,339
Posted By Scrutinizer
Indeed \| is a GNU extension to Basic Regular...
Indeed \| is a GNU extension to Basic Regular Expressions ( BRE ), as are \? and \+. But I do not see a use for them, since GNU utilities also support at least Extended Regular Expressions (ERE)...
1,314
Posted By MadeInGermany
${IARR[-1]} is bash-4. ksh (and bash-3) need...
${IARR[-1]} is bash-4.
ksh (and bash-3) need ${IARR[${#IARR[@]}-1]}

read -A and <<< require ksh93 - do not work with the older ksh88.
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy