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 SkipVought 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. columb

    Non greedy pattern matching

    I'm trying to work on xml without loading the xml parsing bits. Here's what I've got so far #!/usr/bin/perl -w use strict; my $string2 = ' <node description> <hook> <text> Blurb about Red Hat </text> </hook> </node> <node second node> <hook>hooky AIX thing </hook> </node> <node...
  2. columb

    changing primary group within a script.

    If there's a mapping between the file group name and the directory it ends up in then use the suid bit on the directory. For example mkdir -m2777 test_dir chown user:test_grp test_dir Any files created in test_dir will have test_grp group ownership. On the internet no one knows you're a dog...
  3. columb

    Confused about string matching

    So, I'm working with data lines which end with a return code and an optional non numeric message code. What I have so far is my @bits = split /\s+/; if ( $bits[-1] =~ /^\d+$/ ) { $retcode = $bits[-1]; } else { $retcode = $bits[-2]; } No problem with that, it works but why can't I use my...
  4. columb

    NIM restore from mksysb

    I'm testing the 'bare metal' restore of a 650. The system was built and installed as a NIM client. I then did a mksysb using the 'Define a Resource' SMIT screen. I then wanted to test the rebuild. I booted the box into the sms menus and setup the IPL so that network booting would work. I then...
  5. columb

    ssh and quoting

    LKBrwnDBA I would love to go there directly but firewall rules, yada, yada... and the double jump is my only option. Your code works perfectly Thanks On the internet no one knows you're a dog Columb Healy
  6. columb

    ssh and quoting

    I'm writing a procedure in bash which copies files around a number of servers. As a basic check I'm runningssh remote_host 'cd /remote/dir;ls | wc -l' So far all well and good. However some of the servers are only reachable via a double jump. i.e. to run a comand you have to runssh remote1 ssh...
  7. columb

    Treating the last line differently

    Gotcha - It's sort of First line - store in prev Subsequent lines - print prev then store new line in prev - i.e. print the line before. When completed print reformatted final line Thanks Feherke - you're a star as ever. On the internet no one knows you're a dog Columb Healy
  8. columb

    Treating the last line differently

    I have a perl script I would like to migrate to awk. It's quite simple - it copies a file and amends the footer to reflect the number of records (line count so far minus one for the header). In perl it looks like#!/usr/bin/perl -w use strict; $#ARGV == 2 or die "Invalid agument count\n"; open...
  9. columb

    Disk wiping

    We've been told to wipe disks to UK DOD standard 5220.22m. Does anyone know of any products we might use on an SP system running AIX 4.3 I keep saying that half an hour with my Black and Decker would be far more effective but you know what security types are like ;-) Thanks On the internet no...
  10. columb

    yum equivalent of up2date

    Thanks ZaSter - have a star. There's a typo in your link - it's here but I'd got close enough with this list of up2date <-> yum equivalences - which does not have the answer so using your doc number enabled me to find it. On the internet no one knows you're a dog Columb Healy
  11. columb

    simple command line question

    command | less On the internet no one knows you're a dog Columb Healy
  12. columb

    yum equivalent of up2date

    On my old systems I used to run up2date --update --downloadto retrieve the files andup2date --update to apply the patches. Now I've inherited a RHEL 5 server with yum instead of up2date. I've googled all I can but I can't find the equivalent of up2date --update --download for yum. Any pointers...
  13. columb

    SFTP asking for other user's password

    You can't do this using ssh in a raw state. There are two alternatives Use public/private key pairs - this negates the needs for passwords - including the risks of having passwords in clear text in scripts! Google "ssh keys" for many sites which will help Use 'expect' - this is a useful utiliy...
  14. columb

    for loop vs find

    To enlarge on elgrandeperro's point I would say that the guideline is use the for construct unless you want to traverse the directory structure. Note that the -exec parameter to find opens a new process for each file found - as does your for loop so, for functions that take multiple files the...
  15. columb

    find and compress the file without .z

    Why bother excluding - compress will spot the compressed files and skip them. You will get lots of warning messages but, if you're confident the rest works find dir1 dir2 dir3 -type f -mtime +2|xargs compress 2>/dev/null On the internet no one knows you're a dog Columb Healy
  16. columb

    find user su to support login

    Maybe you should buy your sysadmin a beer and suggest he allows you to use sudo to grep out the entries from sulog. On the internet no one knows you're a dog Columb Healy
  17. columb

    How to reuse the same code at different point in a script

    In fact, if you have multiple choices like your sample, then you want to use a 'case' statement For example #!/bin/ksh process_data() { # This is the bit where the common work is done echo processing files for $1 #Note that $1 refers to the first param passed to the function } case...
  18. columb

    Script to monitor that cron jobs are being executed

    Sorry - addendum The /var/adm/cron/log file exists on AIX but not on RedHat Linux so it looks like this method is dependant on your flavour of Unix/Linux On the internet no one knows you're a dog Columb Healy
  19. columb

    Script to monitor that cron jobs are being executed

    Try grep -q Failed /var/adm/cron/log && echo "A cron job has failed" | mail -s "cron job failure" me@myserver Of course you would have to reset the log file after every failure and the script could be nicer but you get the idea. On the internet no one knows you're a dog Columb Healy
  20. columb

    exec to file and screen

    Put a wrapper script around it:- #!/bin/ksh /path/to/my/big/script | tee $LOGFILE On the internet no one knows you're a dog Columb Healy

Part and Inventory Search

Back
Top