Search Results

Search: Posts Made By: Raza Ali
3,825
Posted By nezabudka
Hi Because the shell must first create a...
Hi
Because the shell must first create a channel and then expand the variables.
And if it expands a variable, it skips the channel creation queue and tries to interpret the entire line as one...
3,825
Posted By vgersh99
or better yet /tmp/a.sh: #!/bin/bash while...
or better yet /tmp/a.sh:

#!/bin/bash
while IFS=, read f1 f2 junk
do
eval "$f2"
done < /tmp/a.txt


$ /tmp/a.sh
Filesystem Size Used Avail Use% Mounted on
C:/cygwin64 236G ...
3,825
Posted By vgersh99
either: #!/bin/bash a=$(df -kh|head -2) ...
either:

#!/bin/bash
a=$(df -kh|head -2)
echo "$a"

OR

#!/bin/bash
a='df -kh|head -2'
echo "$a"
eval "$a"

1st is preferred.
1,541
Posted By vgersh99
awk '{a[$1]=($1 in a)?a[$1] OFS $2:$2}END {for (i...
awk '{a[$1]=($1 in a)?a[$1] OFS $2:$2}END {for (i in a) print i,a[i]}' myFile
1,289
Posted By RudiC
Try awk -v THRSTR="600 1800" ' BEGIN {n...
Try

awk -v THRSTR="600 1800" '
BEGIN {n = split (THRSTR, THR)
}
{for (i=1; i<=n; i++) {if ($2 <= THR[i]) break
}
RES[$1,i]++
...
2,776
Posted By shamrock
If file contents are going to have the same rigid...
If file contents are going to have the same rigid format i.e. the first 4 characters are alphabets then the below sort works...
sort -k1.1,1.4 -k1.5,1n file
1,442
Posted By gacanepa
Here you go
#!/bin/bash
echo "You provided the following argument: $1"
if [[ $1 =~ ^[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}$ ]]
then
echo "yes"
else
echo "no"
fi

This script uses regular expressions:...
Showing results 1 to 7 of 7

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