Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. nabana2

    ssh command several variables

    Thanks for explaining that p5wiz. I decided to do this instead so that i could use some variables inside the quotes: cmd=$(ssh 192.168.0.1 "for i in $d1 $d2 $d3; do find /root/dir\$i -type f \( -name "$pre*" \) -printf %f\\\n | wc -l; done")
  2. nabana2

    ssh command several variables

    same problem.
  3. nabana2

    ssh command several variables

    Thanks p5wiz. Still no luck. There is something wrong with the command as it does not return the correct results. To return 1 value is fine but it seems to lose the others in the for loop.
  4. nabana2

    ssh command several variables

    Thanks PHV but i get the same result. All values are set to the last returned result. 8 8 8 instead of 27 5 8
  5. nabana2

    ssh command several variables

    Hi I am trying to return more than one result from a ssh command. [root@server ~]# cmd=`for i in 1 2 3; do find /root/dir$i -type f | wc -l; done` [root@server ~]# echo $cmd 27 5 8 [root@server ~]# cmd=`ssh 192.168.0.1 "for i in 1 2 3; do find /root/dir$i -type f | wc -l; done"`...
  6. nabana2

    set variables in a for loop

    Thanks very much Feherke. I'm half way there. I am now struggling to use the value of my variable in an if statement. I haven't been able to find any info on the internet for what I'm trying to do. My objective is to assign a default value to a set of variables if they have a null value. for...
  7. nabana2

    set variables in a for loop

    Hi I am writing a bash script in which i need to set variables in a for loop. This doesn't seem to work and I'm not sure why it is any different to setting them any where else in the script. I have tried: array=(1 2 3 4 5 6 7 8 9); for i in ${array}; do "V$i"="test"; done but i just get a...
  8. nabana2

    substr() causing false result

    Ofcourse. thanks PHV.
  9. nabana2

    substr() causing false result

    Hi Please could someone explaing the difference between a and b in the script below. Not sure why the "a" test gives a false result. echo 19G 19 | awk '{ alert= 5 a= substr($1,1,length($1)-1) b= $2 if(a <= alert){ print "a: "a" is not less than "alert...
  10. nabana2

    Escaping backslash for outfile

    thanks Tony. I suspected as much.
  11. nabana2

    Escaping backslash for outfile

    Hi I am inserting windows newline charachers into a field with the intention that when i "select into outfile" the field data will be written on several newlines. It seems problem is that the default behaviour is to escape the backslashes when writing the outfile so i end up with the literal...
  12. nabana2

    random and unique in range

    thanks feherke! works well.
  13. nabana2

    random and unique in range

    Hi I am trying to create a random 2 digit number for each input record. The same number must also NOT be generated for at least 10 input records. This is what i have tried. I think I am close but I am not sure how to react to duplicates within the 10 record boundry. Probably also a more clever...
  14. nabana2

    week date conversion

    Hi I'm trying to process a file with dates in the format of "week.year". I need to convert this to "first day of week.month.year" example: 01.2006 to 02.01.2006 02.2006 to 09.01.2006 03.2006 to 16.01.2006 I'm not sure if it's possible to pass the date command a string with the week in it. Is...
  15. nabana2

    Duplicates large file

    Thanks PH Works perfectly. That was a stupid mistake with no file for sort.
  16. nabana2

    Duplicates large file

    Hi I now need to add the last field for the dupilcate columns. so for data like: aaa bbb ccc 10 aaa ddd ddd 10 aaa bbb ccc 20 I would like to get aaa bbb ccc 30 aaa ddd ddd 10 Yet again i can't use arrays so i need to sort an then match the current record with following one. My attempt but...
  17. nabana2

    Duplicates large file

    Thanks PH I did do that at first, which was fine but then I realised I needed to see which lines were duplicated aswell as which lines were unique. Sorry, deviated from my original question.
  18. nabana2

    Duplicates large file

    Thanks PH Had to stick uniq in there to see what the duplicates were. This seems like it does the trick. sort -k 1,10 large.txt | uniq -d > results.txt Presume there would be a way to use sort and awk to do a similar thing.
  19. nabana2

    Duplicates large file

    Hi I have a large file approx. 10 million records or 600mb. I would like to remove dupicates based on the first 10 fields. I have a script which builds an array to match against which works fine on smaller files but my pc falls over if I try to do the same thing with large files. Is there a...
  20. nabana2

    Matching columns + sum

    Thanks vlad Just been running it on real data. Works perfectly, no changes. Third column not too important at the moment, was just trying to simulate the real data as closely as possible. Trying to understand the code at the moment. Thanks again

Part and Inventory Search

Back
Top