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 Chriss Miller 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: *

  • Users: blarneyme
  • Content: Threads
  • Order by date
  1. blarneyme

    Get second part of line with SED

    cat /etc/*release Red Hat Enterprise Linux Server release 5.8 (Tikanga) cat /etc/*release Red Hat Enterprise Linux ES release 4 (Nahant Update 9) I want to extract just 5.8 or 4 I have used cat /etc/*release | sed 's/\(.*\)\([0-9]\{1\}.?[0-9]\?\)\((.*)\)/\2/' but it returns the entire...
  2. blarneyme

    sed if/else or branching?

    This question came up in another thread so I wanted to see if it could be done purely with [b]sed[\b] instead of awk or shell. The output should be I've come close but am missing how to evaluate the first column of the next line with the previous sed '/^$/!{ h s/\(.*\) \(.*\)\n/\1/ N...
  3. blarneyme

    Solaris 8 vxdmpadm

    It has been a long time since I've used Veritas DMP. There are two paths for each LUN, so if there is a switch migration will DMP automatically detect the new paths (AIX would need a cfgmgr)? If there are dead paths, how are they removed (AIX either rmpath or powermt check)? Would a devfsadm...
  4. blarneyme

    SUMA

    This can be modified to suit your needs if you use SUMA. Hopefully someone may find it useful. #!/usr/bin/ksh93 Runfile=/tmp/suma.run CMD="/usr/suma/bin/suma -x " ECHO=/usr/bin/echo CHMOD="/usr/bin/chmod 700" set -A FS $(df -m | grep simages | grep -v "\-00" | awk '{print $7}') set -A RQNAME...
  5. blarneyme

    SED multiple line comment

    I know this is awk, however, since it is closely related to sed... How do you comment multiple lines at once? For example: # cat text line 1 line 2 line 3 line 4 line 5 line 6 line 7 And you want to comment lines 2, 4, and 7. # sed -i'2 s/^line/#/' text will comment line two or # sed -i...
  6. blarneyme

    Remove items from lines

    /my/filesystem host1(sync,ro,fsid=1) host2.domain.com(sync,ro,fsid=1) 127.0.0.10(sync,ro,fsid=1) /other 192.168.1.1(sync,rw,fsid=2) host1(sync,rw,fsid=2) hosta(sync,rw,fsid=2) /junk 192.168.1.2(sync,ro,fsid=3) hostc.domain.com(sync,rw,fsid=3) I have a list containing hosts and IP's of servers...
  7. blarneyme

    File::stat

    I'm using File::stat and when I print the device number of the filesystem, it returns: 64776 although the actual device number is: 253, 8 I'm returning it with: $s = stat($filename); $s->dev; How can I get the actual device number output of "253, 8" instead of 64776?
  8. blarneyme

    Sort a file based on column in another file

    File1: boston:1:x: chicago:1:x: baltimore:1:x: buffalo:1:x: denver:1:x: reno:1:x: dallas:1:x: austin:1:x: File2: chicago:1:x: baltimore:1:x: austin:1:x: dallas:1:x: buffalo:1:x: boston:1:x: denver:1:x: reno:1:x: File2 should be sorted identically to File1. I know how to sort a single file...
  9. blarneyme

    Regular Expression

    Reading mail, I cannot get a regular expression to parse: >U 1 root Fri May 28 10:40 14/563 U 2 root Mon Oct 18 13:01 11/311 U 3 root Mon Oct 18 13:05 11/311 U 4 root Mon Oct 18 13:05 11/311 This doesn't work: sed -n 's/^[>A-Z][...
  10. blarneyme

    Combine two files

    file 1: /export/home/path1 host1 (variables) host2 (variables) host3 (variables) /export/home/path2 host1 (variables) host5 (variables) /export/home/path3 host2 (variables) file 2: /export/home/path1 host2 (variables) host3 (variables) 192.168.1.1 (variables)...
  11. blarneyme

    Finding interpreter

    I have different operating systems and HP-UX places Perl in /usr/contrib/bin, so how do I set the first line so it knows where to find the interpreter? (Creating a link isn't possible.) For the other OS's I have #!/usr/bin/perl but this err's on HP-UX. Placing #!/usr/contrib/bin/perl...
  12. blarneyme

    Change [digit][digit]:[digit][digit] to [digit][digit].[digit][digit]

    Have a file with multiple fields with time in the format: 15:02 that I want in the format 15.02 No matter what I use with sed I'm not getting the desired change. sed 's/\(\d{2}):\(\d{2})/\(\d{2})\.\(\d{2})/g' file > file1 sed 's/[0-9]:[0-9]/[0-9]\.[0-9]/g' file > file1 Neither of the...
  13. blarneyme

    Extract lines between delimiter to file based on first field of record

    Have a text file that contains: xhost1 line with text second line with text third line with text ======================= zhost2 line with text second line with text third line with text fourth line with text fifth line with text ====================== zhost3 line with text second line with text...
  14. blarneyme

    Installing CPAN modules

    Since I'm using OpenBSD which is chroot'd to /var/www I set my modules to use /var/www/usr # perl Makefile.PL PREFIX=/var/www/usr However, when running `make` on a module with dependencies, it isn't finding them because it is searching /usr for the dependency but the modules were installed...
  15. blarneyme

    Formatting file output

    /etc/exports: # # # /dir/path hostname1.my.domain(rw,sync,no_root_squash,fsid=0) \ hostname2.my.domain(rw,sync,no_root_squash,fsid=0) \ hostname3.my.domain(rw,sync,no_root_squash,fsid=0) \ hostname4.my.domain(rw,sync,no_root_squash,fsid=0) /other/path...
  16. blarneyme

    Dynamically add data

    Below is my code, but I want it to add rows each time if necessary. So when I press submit it would bring up the same form again but display the previously added data to the form. When done, then it would send all 6 (or however many) rows of data. use CGI; $q = new CGI; print $q->header; print...
  17. blarneyme

    Exclude directories using File::Find::dir

    I'm using File::Find::dir to find a particular file that may exist on a server, however, there are NFS mounts that I need to exclude. This is the pertinent section of my code. find(sub { if ($_ =~ /myfile$/) { push(@files, [$File::Find::dir ...
  18. blarneyme

    Use an array?

    open VXDISK,"vxdisk -o alldgs list |" or die "unable to run vxdisk\n"; Using the above which works for the remainder of what I'm doing, however I now need to make sure vxdisk doesn't read some disk groups, which would work if I added vxdisk -o alldgs list| grep -v rootdg | grep -v thisdg |...
  19. blarneyme

    No Expect forum --- so maybe someone knows the answer

    Need to run something remotely and am using Expect which works. However, there are times when I'm prompted differently and I'm unsure how to get around it. For example: at times prompted: (yes/no)? Password: other times prompted: Password: To account for this I've used: expect {...
  20. blarneyme

    Automatically enter input

    I need to automatically enter input without having to type yes or a password. Trying to use Open2 but not getting it to work. #!/usr/bin/perl use IPC::Open2; $pid = open2(*READFROM, *WRITETO, "/tmp/Install.sh arg1"); print WRITETO "here's your input\n"; while ($output = <READFROM>){...

Part and Inventory Search

Back
Top