Search Results

Search: Posts Made By: jsmoriss
15,038
Posted By jsmoriss
A sed version... sed -n...
A sed version...


sed -n 's/^.*<\(CountryCode\|CountryName\|RegionName\|City\)>\([^<]*\)<\/.*$/\2/p


js.
15,492
Posted By jsmoriss
You could use a case statement: case...
You could use a case statement:


case $REMOTE_USER in
joe|bob|elvis) echo ok ;;
*) echo fail ;;
esac


js.
3,994
Posted By jsmoriss
You want to create "array like variables" in...
You want to create "array like variables" in bourne shell? Hm. How about this?


n=0
for val in a b c
do
eval var$n="$val"
n="`expr $n + 1`"
done


That would give you 3...
8,880
Posted By jsmoriss
That assumes there are no fields starting with...
That assumes there are no fields starting with blanks, that are one or more spaces, etc. I'm thinking the OP wants to remove commas from quoted fields, so this might be safer:

sed...
3,994
Posted By jsmoriss
echo $* | tr -d ' ' js. ----------...
echo $* | tr -d ' '


js.

---------- Post updated at 10:23 AM ---------- Previous update was at 10:20 AM ----------

Here's another in bash (not bourne):

var="$*"
echo ${var// /}


js.
5,881
Posted By jsmoriss
In what language? Assuming bourne shell, how...
In what language?

Assuming bourne shell, how about:


expr index filename len >/dev/null && echo ok


js.
1,498
Posted By jsmoriss
True. I tend to type one-offs on a single line......
True. I tend to type one-offs on a single line... Tsdk, tsk. :-)



Depends on the shell you use...

js.
3,249
Posted By jsmoriss
grep '[013-7]' js.
grep '[013-7]'

js.
1,498
Posted By jsmoriss
for d in dir/* do; [ -d "$d" ] && egrep -v...
for d in dir/* do; [ -d "$d" ] && egrep -v "^`basename $d`$" file.txt > /tmp/file.$$ && mv /tmp/file.$$ file.txt || exit 1; done

js.
1,736
Posted By jsmoriss
You could try adding a -regex or -name to find,...
You could try adding a -regex or -name to find, making sure the filenames returned by find are in an acceptable format, or add a grep right before your awk.

js.
1,460
Posted By jsmoriss
Are you talking about "snmptrap"? You could...
Are you talking about "snmptrap"? You could probably do something like:

while read line; do snmptrap {args here} "$line"; done < input.txt

js.
2,137
Posted By jsmoriss
I don't think sed supports the {##} suffix, but...
I don't think sed supports the {##} suffix, but perl does. Here's an (untested) adaptation of the above:

perl -n -e 's/^(.{180})([^-]*)-(.*)$/$1-$2$3/' input.txt

js.
1,165
Posted By jsmoriss
if echo 123 | grep -q 2; then echo ok; fi
if echo 123 | grep -q 2; then echo ok; fi
97,893
Posted By jsmoriss
Depending on how you're using wget, you can use...
Depending on how you're using wget, you can use the routing table to send traffic through the right interface (assuming different destinations for those wgets).

js.
4,189
Posted By jsmoriss
Hash within array, within hash, within array...
I have a little problem. To keep a configuration simple, I've exceeded my perl knowledge. :-) I've worked with multi-dimentional arrays before, but this one has me beat:


@info = (
{
...
Showing results 1 to 15 of 15

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