Skip to main content

Thread: Basic Scripting Help


how can create simple script check existance of set of numbers within file listing previous sets?

example:

11 55 88

exist in following list

66 77 99
42 33 29
88 55 11

, order not relevant. in above example, there match last line. trying think of way of doing in libre office, couldn't work seperating numbers different fields.

hay,

seems (after googling) there no simple answer, seeing order not matter. how ever, might try this, dont have time write code , test it. here outline:

value 11 22 88
asign $1 $2 $3

string test:
value 22 11 88
asign $4 $5 $6

test sequence: if ${1..3}=${4..6} +1 $string_match
if $string_match => echo "string match" else "string doesn't match"...

should easy do, awk allows using data in coloums specifing it:
http://www.unix.com/unix-dummies-que...ease-help.html
in simplest usage awk meant processing column-oriented text data, such tables, presented on standard input. variables $1, $2, , forth contents of first, second, etc. column of current input line. example, print second column of file, might use following simple awk script:
awk < file '{ print $2 }'
means "on every line, print second field".

print second , third columns, might use
awk < file '{ print $2, $3 }'

comparing inputs each other easy en if statement:

code:
if [ "a$1" -eq "a$4" ]      $match="$match + 1"  fi

may errorous.. thats rough idea have.. may simpler way... asleep think straight atm.

cherz

edit
fixed major typos.. , gave more relavent info... seeing dubble , not cause of bubble hahahaha


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] Basic Scripting Help


Ubuntu

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?