Search Results

Search: Posts Made By: Chubler_XL
94
Posted By Chubler_XL
This is working as expected in bash 4.4.12 $...
This is working as expected in bash 4.4.12

$ var="/etc/tomcat/server.xml /etc/tomcat/test/server.xml"
$ var2=( $var )
$ echo ${var2[0]}
/etc/tomcat/server.xml
$ echo ${var2[1]}...
323
Posted By Chubler_XL
Nice procedure nezabudka, but original request...
Nice procedure nezabudka, but original request was selection of item by number or by name:



For a higher level of difficulty how about spaces in the options:

#!/bin/bash
listofitems="fried...
577
Posted By Chubler_XL
Sorry about my delay in gettng back think...
Sorry about my delay in gettng back think timezone differences are involved here. looks like we have some nice solutions coming together in this thread now.

This is the pseudo code I had in mind...
Forum: What is on Your Mind? 02-20-2020
707
Posted By Chubler_XL
Very cool. I did a lot of mucking around...
Very cool.

I did a lot of mucking around with Simulated Annealing and the Metropolis algorithm while in uni. Using it for tasks like fitting various sized files onto minimum numbers of floppy...
423
Posted By Chubler_XL
This looks like a homework question to me, I...
This looks like a homework question to me, I hope you were told not to try running this program on a production system.
462
Posted By Chubler_XL
A process calls the wait() function and kernel...
A process calls the wait() function and kernel level code checks the status of a child process, it will suspend execution of the calling thread until status information for one of the terminated...
1,582
Posted By Chubler_XL
You could use sed (or similar) to convert your...
You could use sed (or similar) to convert your input syntax to an awk expression eg:

CONDITIONS="(1=CT or 2=US_10) and 3=CT_US_10 and 4="
CONDITIONS=$(echo "$CONDITIONS" |
sed \
-e...
Forum: Linux 02-16-2020
935
Posted By Chubler_XL
What value do you have for swappiness...
What value do you have for swappiness (https://en.wikipedia.org/wiki/Paging#Swappiness):

# cat /proc/sys/vm/swappiness
60


You can try tweaking this back a lower percentage (eg add/change...
1,056
Posted By Chubler_XL
This forum is not a script writing service. ...
This forum is not a script writing service.

If you have a solution you have worked on that is not complete we can help you, but you must have shown some effort to solve this yourself.

Also...
848
Posted By Chubler_XL
the first < is a standard input redirection and...
the first < is a standard input redirection and causes input to the read command to come from a file.

The second part is process substitution witch takes the format of <(list). The value list...
848
Posted By Chubler_XL
This is because commands within a pipeline are...
This is because commands within a pipeline are run in subshells so the read statement is setting the variables is a subshell which has not impact on the main shell.

You can achieve what you want...
600
Posted By Chubler_XL
This function is quite well commented, it...
This function is quite well commented, it basically uses the tail command to print the last MAX_LENGTH ($2) lines of FILE ($1) these are stored in a temporary file (name generated by the mktmp...
907
Posted By Chubler_XL
That looks like a good approach. You could...
That looks like a good approach.

You could get some more efficiency by not calling the date external on each input line and using bash to convert the date time to an mmddHHMMSS number for direct...
2,324
Posted By Chubler_XL
Ensure dollar variable to be expanded is outside...
Ensure dollar variable to be expanded is outside of single quotes eg:
echo 'File not found in '"$PWD"', please re-enter'

In your script you would do:

for i in `cat file1`
do
...
Forum: Solaris 12-19-2019
3,363
Posted By Chubler_XL
Discussion moved to Solaris area, you will find...
Discussion moved to Solaris area, you will find more people with the Solaris specific knowledge to answer this question here.
1,185
Posted By Chubler_XL
Firstly the posted script seems to be missing...
Firstly the posted script seems to be missing single quote at the start of the awk code, and two single quotes at the end.

Also your system is reporting that nawk is not installed nawk is usually...
1,073
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]
...
243
Posted By Chubler_XL
/LISTEN/ && ! /127.0.0.1/ Match lines...
/LISTEN/ && ! /127.0.0.1/
Match lines containing LISTEN and not 127.0.0.1

gsub("::", "ALL", $0)
Replace :: with ALL on entire line

if ($4 ~ ":") { RECV[$2] }
if field #4 contains : store...
1,167
Posted By Chubler_XL
Your encode should pretty much be the same...
Your encode should pretty much be the same function as your decode, just use crypt array instead of decrypt:


encode ()
{
local word=$1
while [[ $word ]] ;
do
local code
...
243
Posted By Chubler_XL
This should be close to what you were doing. ...
This should be close to what you were doing.

netstat -an | awk '
/LISTEN/ && ! /127.0.0.1/ {
gsub("::", "ALL", $0)
if ($4 ~ ":") { RECV[$2] }
}
/ESTABLISHED/ && ($2 in RECV) {
...
1,300
Posted By Chubler_XL
There are a couple of things I'm a little unhappy...
There are a couple of things I'm a little unhappy with in my proposed solution and I'd like to update to a more robust version.

Firstly if the JSON structure contains array of objects decend()...
372
Posted By Chubler_XL
Welcome to the forums. If you are not...
Welcome to the forums.

If you are not expecting the directories to already be there (eg running the script multiple times against the same input file), you could test for the existence and...
1,300
Posted By Chubler_XL
The normal practice would be to redirect to a...
The normal practice would be to redirect to a temporary file and then move the temp file over the original.

jq -c '.....' infile > /tmp/jqtemp.$$ && mv -f /tmp/jqtemp.$$ infile
1,300
Posted By Chubler_XL
It's not valid to have same key multiple times in...
It's not valid to have same key multiple times in the one record. Try running your input thru a JSON validator (https://jsonformatter.curiousconcept.com/)
1,300
Posted By Chubler_XL
After reading your request again it appears you...
After reading your request again it appears you want to identify an IP addresses in any non-array JSON data array and convert it to an array.

input :
{"adaptor" : "ip01" , "gateway" :...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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