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...
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...
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...
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...
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...
/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...
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?
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...
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][...
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...
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...
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...
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...
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...
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 ...
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 |...
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 {...
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>){...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.