- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Script ISSUE
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 04:58 PM
11-15-2005 04:58 PM
I am facing some problem on script,
i want to assign output(i.e some file) to some variable its given below, after that i want rename this filename.
gmfile=$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})
mv gmfile xxtest.txt
but its not working pls help me on this
Solved! Go to Solution.
- Tags:
- command substitution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 05:04 PM
11-15-2005 05:04 PM
Re: Script ISSUE
Have you set all required variables??
set -vx, now do gmfile=$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})
Does complain about anything??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 05:22 PM
11-15-2005 05:22 PM
Re: Script ISSUE
I set all varibales
i runned the same but its same problem file received on filesystem but not assign to variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 05:27 PM
11-15-2005 05:27 PM
Re: Script ISSUE
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
gmfile="$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})"
echo ${gmfile}
post this information.!
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 05:50 PM
11-15-2005 05:50 PM
Re: Script ISSUE
/opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER}
For this output is,
file will copied on filesystem /usr/
gmfile="$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})"
echo ${gmfile}
for this output is,
null there is no output but file copied to filesystem
Actually what my problem i receive file containing ^M containing i want to remove ^M character then copied to that samefilename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 05:59 PM
11-15-2005 05:59 PM
Re: Script ISSUE
Change it as,
dos2ux filename > newfile
strings filename > newfile
It will be changed.
hth.
- Tags:
- dos2ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:01 PM
11-15-2005 06:01 PM
Re: Script ISSUE
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=972302
If you want to change into the same file then,
perl -pi -e 's/\^M//g' filename
hth.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:02 PM
11-15-2005 06:02 PM
Re: Script ISSUE
my file name is hptest.txt
opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER
after i runned this one
/usr/hptest.txt but containing ^M character
i want to remove ^M character then filename should be /usr/hptest.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:03 PM
11-15-2005 06:03 PM
Re: Script ISSUE
gmfile=$(/opt/mqm/scripts/mqigetfn CREATE "${DIRECTORY}/ ${QNAME} ${QMANAGER}")
echo ${gmfile}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:13 PM
11-15-2005 06:13 PM
Re: Script ISSUE
/opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER}
perl -pi -e 's/\^M//g' /usr/hptest.txt
It will do it.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:13 PM
11-15-2005 06:13 PM
Re: Script ISSUE
This will remove ^M characters from /usr/hptest.txt file and also make a backup copy with .bak extension (ie. hptest.txt.bak)
hth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:19 PM
11-15-2005 06:19 PM
Re: Script ISSUE
its not removing ^M character
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 06:21 PM
11-15-2005 06:21 PM
Re: Script ISSUE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 07:16 PM
11-15-2005 07:16 PM
Re: Script ISSUE
perl -pi -e 's/\r\n/\n/g' /usr/hptest.txt
Example:
# cat -v test.txt
hi^M
bye # perl -pi -e 's/\r\n/\n/' test.txt
# cat -v test.txt
hi
bye#
Steps:
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
perl -pi -e 's/\r\n/\n/g' /usr/hptest.txt
hth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 07:34 PM
11-15-2005 07:34 PM
Re: Script ISSUE
perl -pi -e 's/\r\n/\n/g' /usr/hptest.txt
this is working but
that filename i dont know this are through script that time how should i get the filename
from ls -tr how i should i take last row filename i.e latest file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 07:39 PM
11-15-2005 07:39 PM
Re: Script ISSUE
will give you the name of the last modified file.
hth
- Tags:
- tail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 07:45 PM
11-15-2005 07:45 PM
Re: Script ISSUE
Question 1:
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
what is ${DIRECTORY}, ${QNAME} and ${QMANAGER} variable contents.
--
We can get latest file in /usr directory as,
cd /usr
ls -lt | head -2 | tail -1 | awk '{ print $9 }'
It will not work all the times. If some body update the file contents then hpuxtest.txt will not come anyway.
Question 2:
Is the new file creation will be with hpuxtest.txt only or with some other specific name.
--
Question 3:
Is /opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER} copying file to /usr directory? Is there any verbose information which saying that specific file is copied to location?
--
Post all relavent informations to answer.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 08:09 PM
11-15-2005 08:09 PM
Re: Script ISSUE
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
${DIRECTORY} is /usr/received/
&{QNAME}-Qeuenname
${QMANAGER}-QueueManager Name
I will receive file from some other place i.e Singapore
Question 2:
Is the new file creation will be with hpuxtest.txt only or with some other specific name.
No filename would be differenct at each time
--
Question 3:
Is /opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER} copying file to /usr directory?
No Verbose information
last question
we can use perl command on shell script
--
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 08:13 PM
11-15-2005 08:13 PM
Re: Script ISSUE
Yes. Surely. You can use all shell actions with shell scripts.
The only problem you are having now is the filename which you are getting from singapore. /opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER} action is not returning any filename information. How do you know that it will create in /usr/ location? Collect the location where exactly that application copies the file.
Can you post the execution details of,
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
in shell to help you out with suitable shell code(s).
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 08:55 PM
11-15-2005 08:55 PM
Re: Script ISSUE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 09:47 PM
11-15-2005 09:47 PM
Solution#!/bin/ksh
PATH=$PATH:/usr/bin:/usr/sbin
rm -f /tmp/old.log /tmp/new.log
ls -l ${DIRECTORY} > /tmp/old.log
/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}
ls -l ${DIRECTORY} > /tmp/new.log
FILENAME=$(grep -vf /tmp/old.log /tmp/new.log | awk '{ print $9}')
echo "New filename --> ${FILENAME}"
perl -pi -e 's/\r\n/\n/' ${FILENAME}
# end
exit 0
###
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 12:08 AM
11-16-2005 12:08 AM
Re: Script ISSUE
now my script is working fine.