UNIX.com
UNIX and Linux Forums - Learn UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts
URL: http://www.unix.com/
Updated: 17 min 26 sec ago
How to spilt huge string in AIX ?
I have few AIX 5.3 boxes where following is the issue.
I have a variable whose value is a very huge string ...(5000+ characters)
Code: CMD_ARGS="/global/site/vendor/WAS/WebSphere6/AppServer/java/bin/java -Dcom.ibm.ws.client.installedConnectors=/global/site/vendor/WAS/WebSphere6/AppServer/profiles/dmgr/installedConnectors -Dcom.ibm.CORBA.ConfigURL......................................................................................:/global/site/vendor/WAS/WebSphere6/AppServer/lib/j2ee.jar com.ncode.DMIServer.DMIMain" Now i want to capture everything except $1 i.e in above example... "-Dcom" onwards everything....
How do i do this ?
Regards
Abhi
I have a variable whose value is a very huge string ...(5000+ characters)
Code: CMD_ARGS="/global/site/vendor/WAS/WebSphere6/AppServer/java/bin/java -Dcom.ibm.ws.client.installedConnectors=/global/site/vendor/WAS/WebSphere6/AppServer/profiles/dmgr/installedConnectors -Dcom.ibm.CORBA.ConfigURL......................................................................................:/global/site/vendor/WAS/WebSphere6/AppServer/lib/j2ee.jar com.ncode.DMIServer.DMIMain" Now i want to capture everything except $1 i.e in above example... "-Dcom" onwards everything....
How do i do this ?
Regards
Abhi
Concatenate Loop Results
Hi,
I have the following situation:
Param1Values = AAAA,BBBB
Param1=$(echo $Param1Values| tr "," "\n")
for x in $Param1
do
db2 select X from Y where Z IN ('$x')
done
Obviously the above will perform the select 'x' amount of times.
Is there a way in which i can concatanate the results of the loop into one string, so i can perform the select statement once?
So currently i will have:
db2 select X from Y where Z IN ('AAAA')
db2 select X from Y where Z IN ('BBBB')
Is there a way in which manipulating the above will result in:
db2 select X from Y where Z IN ('AAAA','BBBB')
NOTE: Param1Values will not have a set amount of values i.e. it wont always be 2 parameters, it can be different everytime.
Cheers
I have the following situation:
Param1Values = AAAA,BBBB
Param1=$(echo $Param1Values| tr "," "\n")
for x in $Param1
do
db2 select X from Y where Z IN ('$x')
done
Obviously the above will perform the select 'x' amount of times.
Is there a way in which i can concatanate the results of the loop into one string, so i can perform the select statement once?
So currently i will have:
db2 select X from Y where Z IN ('AAAA')
db2 select X from Y where Z IN ('BBBB')
Is there a way in which manipulating the above will result in:
db2 select X from Y where Z IN ('AAAA','BBBB')
NOTE: Param1Values will not have a set amount of values i.e. it wont always be 2 parameters, it can be different everytime.
Cheers
Windows to Unix Admin
Hi,
I'm looking a bit of advice on a job offer I've been made.
I'm currently a Microsoft Windows Administrator, with good experience in this and also in Novell.
I've just been offered a job to re-train as a UNIX Administrator.
I'm not sure whether to take it or not. It's more salary, and I was thinking if I had Windows, Novell and UNIX skills I would be very employable.
I'm just concerned that I make the correct choice, i.e. is UNIX more specialised, and would this be a big career change i.e. how different would the career path of a Windows Systems Admin be to that of a UNIX Systems Admin?
Anyone any advice?
Thanks for reading.
I'm looking a bit of advice on a job offer I've been made.
I'm currently a Microsoft Windows Administrator, with good experience in this and also in Novell.
I've just been offered a job to re-train as a UNIX Administrator.
I'm not sure whether to take it or not. It's more salary, and I was thinking if I had Windows, Novell and UNIX skills I would be very employable.
I'm just concerned that I make the correct choice, i.e. is UNIX more specialised, and would this be a big career change i.e. how different would the career path of a Windows Systems Admin be to that of a UNIX Systems Admin?
Anyone any advice?
Thanks for reading.
Put output into an array
I'm trying to take the output of an environment that has multiple strings
ex.
Code: # echo $SSH_CLIENT
192.168.1.1 57039 22 I need that IP... so I can set it to another environment.
Thank you
ex.
Code: # echo $SSH_CLIENT
192.168.1.1 57039 22 I need that IP... so I can set it to another environment.
Thank you
Using SED command in a shell script: Unterminated address regex
Hi All,
I am trying to use a sed command in a shell script in order to delete some lines in a file and I got the following error message.
I don't understand why it is not working 'cause I have tried with simple quotes, then with double-quotes, and it is not working.
sed: -e expression #1, char 4: Unterminated address regex
Here below is the code I used in my shell script:
1- First I read a Exclusion file where I retrieve in each line a Pattern
2- Then I use this pattern in sed cmd to delete the corresponding line and put the result in another file
Code: buildGrep()
{
nbl=`cat $exclusionFile | wc -l`
i=1
exclusion=`cat $exclusionFile | tail -${i} | head -1`
exclusions="sed -e /${exclusion}/d"
while [ $i -lt $((nbl+1)) ];
do
exclusions="${exclusions} -e '/${exclusion}/d'"
i=`expr $i + 1`
exclusion=`cat $exclusionFile | tail -${i} | head -1`
done
FinalExclusion=`${exclusions} <${TemporaryFile} >${aFiltered_monerrFile}`
}
aDate=`date '+%y.%m.%d_%H.%M.%S'`
aFiltered_monerrFile=Filtered_File.txt
TemporaryFile=TempFile$aDate.txt
ssh xxxx@xxxxx fgrep "2010\/03\/10" xxxxxxxxxxxxx/OriginalFile > $TemporaryFile
exclusionFile=xxxxx.dat
buildGrep Have somebody any idea ?
Thank you in advance,
Alpha
I am trying to use a sed command in a shell script in order to delete some lines in a file and I got the following error message.
I don't understand why it is not working 'cause I have tried with simple quotes, then with double-quotes, and it is not working.
sed: -e expression #1, char 4: Unterminated address regex
Here below is the code I used in my shell script:
1- First I read a Exclusion file where I retrieve in each line a Pattern
2- Then I use this pattern in sed cmd to delete the corresponding line and put the result in another file
Code: buildGrep()
{
nbl=`cat $exclusionFile | wc -l`
i=1
exclusion=`cat $exclusionFile | tail -${i} | head -1`
exclusions="sed -e /${exclusion}/d"
while [ $i -lt $((nbl+1)) ];
do
exclusions="${exclusions} -e '/${exclusion}/d'"
i=`expr $i + 1`
exclusion=`cat $exclusionFile | tail -${i} | head -1`
done
FinalExclusion=`${exclusions} <${TemporaryFile} >${aFiltered_monerrFile}`
}
aDate=`date '+%y.%m.%d_%H.%M.%S'`
aFiltered_monerrFile=Filtered_File.txt
TemporaryFile=TempFile$aDate.txt
ssh xxxx@xxxxx fgrep "2010\/03\/10" xxxxxxxxxxxxx/OriginalFile > $TemporaryFile
exclusionFile=xxxxx.dat
buildGrep Have somebody any idea ?
Thank you in advance,
Alpha
Number of users in passwd
This command prints out username/users in /etc/passwd:
Code: cut -d ':' -f '1,5' /etc/passwd | sort I wonder if I also, after above commands output, can get an output that lists number of users in the group? I need to use uniq to get rid of duplicates.
I´ve tried this, but cant get it right, can anyone help please?
Code: cut -d ':' -f '1,5' /etc/passwd | sort I wonder if I also, after above commands output, can get an output that lists number of users in the group? I need to use uniq to get rid of duplicates.
I´ve tried this, but cant get it right, can anyone help please?
Sun T5120 hardware RAID question
Hi everyone
I've just purchased a Sun T5120 server with 2 internal disks. I've configured hardware RAID (mirror) and as a result the device tree in Solaris only contains 1 hard drive.
My question is, how would I know when one of the drives become faulty?
Thanks
I've just purchased a Sun T5120 server with 2 internal disks. I've configured hardware RAID (mirror) and as a result the device tree in Solaris only contains 1 hard drive.
My question is, how would I know when one of the drives become faulty?
Thanks
scp is not working through sh script
Hi All,
I am generating a ~ delimited file from oracle table and then transfer it to another server through scp.
Code:
if [ -f $COM_DIR/ABC.txt ]
then
scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt
else
echo "File does not exist, please check" >>$LOG
fi The script generates the file, but not able to deliver it to another server. To check what is the problem with scp command, i have tried to redirect the output to the LOG file like...
Code:
if [ -f $COM_DIR/ABC.txt ]
then
scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt >> $LOG
else
echo "File does not exist, please check" >>$LOG
fi but still it is not working.
While i executed only the scp command on command prompt, it works. Can someone tell me what could be a problem?
I am generating a ~ delimited file from oracle table and then transfer it to another server through scp.
Code:
if [ -f $COM_DIR/ABC.txt ]
then
scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt
else
echo "File does not exist, please check" >>$LOG
fi The script generates the file, but not able to deliver it to another server. To check what is the problem with scp command, i have tried to redirect the output to the LOG file like...
Code:
if [ -f $COM_DIR/ABC.txt ]
then
scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt >> $LOG
else
echo "File does not exist, please check" >>$LOG
fi but still it is not working.
While i executed only the scp command on command prompt, it works. Can someone tell me what could be a problem?
Day 2 of the SCO v. Novell Trial - Opening argument - Updated Repeatedly - 1st Witness, Frankenber
Would it surprise you to find out that it turns out that apparently one of the jurors might be related to one of SCO's prior corporate officers? At any rate they have the same last name, and Salt Lake City is a big place, so perhaps not. Novell noticed the similarity in names, according to our reporter today, MSS2, only after jury selection was over.
MSS2 has just sent me his first report of day 2 of the jury trial in SCO v. Novell, with more to come. Today was opening arguments by both sides. And we have lots more goodies for you from two eyewitnesses, MSS2 and Tilendor. We begin with SCO's opening argument by Stuart Singer. All I can say after reading it is maybe you needed to be there. Or SCO must be a slow learner or Mr. Singer never reads Groklaw, or ... well, see what you think.
More...
MSS2 has just sent me his first report of day 2 of the jury trial in SCO v. Novell, with more to come. Today was opening arguments by both sides. And we have lots more goodies for you from two eyewitnesses, MSS2 and Tilendor. We begin with SCO's opening argument by Stuart Singer. All I can say after reading it is maybe you needed to be there. Or SCO must be a slow learner or Mr. Singer never reads Groklaw, or ... well, see what you think.
More...
Jonathan Schwartz: What He Couldn't Say (on Patents, OpenOffice, and Bill Gates)
I know we are all riveted on Utah today, but take a moment, please, because this is important. Jonathan Schwartz, formerly CEO of Sun, has a personal blog, What I Couldn't Say ..., where he has begun to tell us what he couldn't tell us before about events during his tenure there. He has a interesting tale to tell about Bill Gates and Steve Ballmer asking Sun to pay patent royalties to Microsoft on ... OpenOffice.
More...
More...
Hitler cloud sec
You may or may not be aware of the mass of "Hitler rant" videos on YouTube. These take a clip (from the movie "Downfall") and subtitle it with a rant from Hitler about everything from college football to the iPhone to Facebook accounts to ... well, anything at all.
This one is about cloud computing and security, and makes a few cute points about security in general.
More...
This one is about cloud computing and security, and makes a few cute points about security in general.
More...
Having trouble generating web certificate
hi, everyone.
i am having trouble configuring SSL for an IBM HTTP Server. system is running websphere with oracle db on aix5.3tl10.
looking at google, the best way to generate ssl is with ikeyman. however, the gui has been disabled, so i only have the command line to work from.
please help
i am having trouble configuring SSL for an IBM HTTP Server. system is running websphere with oracle db on aix5.3tl10.
looking at google, the best way to generate ssl is with ikeyman. however, the gui has been disabled, so i only have the command line to work from.
please help
how to combine nics for DM Multipath
I don't undestand how to combine 4 nics in order to use DM Multipath. Do I have to install each nic with its IP address? If yes, do I need a group IP address? This concept is not clear for me.
The connection beetwen the server (DELL Poweredge T710) and the SAN through iscsi works well, I used multipath but only one nic is configured with its IP address. But the server has 4 nics and I would combine them with multipath!
the devices are:
SAN DELL equallogic (3 nics)
DELL Poweredge T710 (4 nics)
2 switch 5424
The connection beetwen the server (DELL Poweredge T710) and the SAN through iscsi works well, I used multipath but only one nic is configured with its IP address. But the server has 4 nics and I would combine them with multipath!
the devices are:
SAN DELL equallogic (3 nics)
DELL Poweredge T710 (4 nics)
2 switch 5424
want to move files in a dir into different directories based on the filename
I want to move the files in a dir to different dirs based on their file names.
Ex: i have 4 different files with name -
CTS_NONE_10476031_MRL_PFT20081215a.txt
CTS_NONE_10633009_MRL_PFT20091020a.txt
CTS_NONE_10345673_MRL_PFT20081215a.txt
CTS_NONE_10872456_MRL_PFT20091020a.txt
and the 1st file should go to the dir 'OLD_10476031', 2nd file into dir 'OLD_10633009' , 3rd into dir OLD_10345673 and so on.
tried differnt ways in ksh script but none are working correctly
I have a HP-UX machine and using KSH.
Thanks in advance for help.
Ex: i have 4 different files with name -
CTS_NONE_10476031_MRL_PFT20081215a.txt
CTS_NONE_10633009_MRL_PFT20091020a.txt
CTS_NONE_10345673_MRL_PFT20081215a.txt
CTS_NONE_10872456_MRL_PFT20091020a.txt
and the 1st file should go to the dir 'OLD_10476031', 2nd file into dir 'OLD_10633009' , 3rd into dir OLD_10345673 and so on.
tried differnt ways in ksh script but none are working correctly
I have a HP-UX machine and using KSH.
Thanks in advance for help.
want to move files in a dir into different directories based on the filename
I want to move the files in a dir to different dirs based on their file names.
Ex: i have 4 different files with name -
CTS_NONE_10476031_MRL_PFT20081215a.txt
CTS_NONE_10633009_MRL_PFT20091020a.txt
CTS_NONE_10345673_MRL_PFT20081215a.txt
CTS_NONE_10872456_MRL_PFT20091020a.txt
and the 1st file should go to the dir 'OLD_10476031', 2nd file into dir 'OLD_10633009' , 3rd into dir OLD_10345673 and so on.
tried differnt ways in ksh script but want a shrt and efficient script :)
I have a HP-UX machine and using KSH.
Thanks in advance for help.
Ex: i have 4 different files with name -
CTS_NONE_10476031_MRL_PFT20081215a.txt
CTS_NONE_10633009_MRL_PFT20091020a.txt
CTS_NONE_10345673_MRL_PFT20081215a.txt
CTS_NONE_10872456_MRL_PFT20091020a.txt
and the 1st file should go to the dir 'OLD_10476031', 2nd file into dir 'OLD_10633009' , 3rd into dir OLD_10345673 and so on.
tried differnt ways in ksh script but want a shrt and efficient script :)
I have a HP-UX machine and using KSH.
Thanks in advance for help.
active ports
wat is the file name that reveals information that what ports are open in system..
How to find duplicate commands in the search path?
I wanted to see if there is any duplicate of a specific command in the command search path. The following code will list all copies of "openssl" in the command search path.
Code: find `printenv PATH | sed "s/:/ /g"` -maxdepth 1 -name openssl However, the above code would fail if the search path contains any directory whose name contains a space such as "my commands". The main reason for the failure is that a space is the delimiter in the list of directories for the "find" command.
The following workaround changes the delimiter from a space to a colon by modifying the global variable IFS.
Code: IFS=":"; find `printenv PATH` -maxdepth 1 -name openssl; IFS=$' \t\n'; However, I do not want to modify global variables. Can anyone suggest me any better methods? The method must work even if a directory name contains a space.
Thanks in advance.
Code: find `printenv PATH | sed "s/:/ /g"` -maxdepth 1 -name openssl However, the above code would fail if the search path contains any directory whose name contains a space such as "my commands". The main reason for the failure is that a space is the delimiter in the list of directories for the "find" command.
The following workaround changes the delimiter from a space to a colon by modifying the global variable IFS.
Code: IFS=":"; find `printenv PATH` -maxdepth 1 -name openssl; IFS=$' \t\n'; However, I do not want to modify global variables. Can anyone suggest me any better methods? The method must work even if a directory name contains a space.
Thanks in advance.
Troubleshooting general issues with syslog
Hi,
how to troubleshoot general system issue with the help of syslog file...and how to understand entries in syslog file....?
how to troubleshoot general system issue with the help of syslog file...and how to understand entries in syslog file....?
Sun Solaris Installation
Hi,
I am newbie in solaris administration.
Can i get site/DOC for below tasks?
1.Solaris Operating System Installation
2.Creation of Mount points
3.Creation of Users and Groups
Complete guide from scratch for new server.:b:
Regards,
Vinodh' Kumar
I am newbie in solaris administration.
Can i get site/DOC for below tasks?
1.Solaris Operating System Installation
2.Creation of Mount points
3.Creation of Users and Groups
Complete guide from scratch for new server.:b:
Regards,
Vinodh' Kumar
how to source csh script in tcl script
i have atcl script and i want to source a csh script to reflect changes done by script ........
Please help.......
Please help.......

Recent comments
1 week 16 hours ago
2 weeks 6 days ago
2 weeks 6 days ago
2 weeks 6 days ago
2 weeks 6 days ago
9 weeks 5 days ago
9 weeks 5 days ago
41 weeks 5 hours ago
41 weeks 9 hours ago
41 weeks 4 days ago