Hi
I am doing one script in which am trying to put the linfo i.e the number of records of a file into log file so what i did was i did the ds job command and did a grep and cut command to get the num of records and here is my command
dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30
It works fine...
But my requirement is i need to append to a file in specified format ... so it shopuld be like
for ex:
Records : 72222
so what i did was i did like
print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filename
it not doing anyhting...
so i itred to put into a variable say
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
and do like printf 'Records : $var1' >> myfile.txt
it not doing any thing either the funny part is am not geeting any error either..Pls help me out.....
DSJob command to a variable
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 407
- Joined: Mon Jun 27, 2005 8:54 am
- Location: Walker, Michigan
- Contact:
Re: DSJob command to a variable
print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filenameg_rkrish wrote:Hi
I am doing one script in which am trying to put the linfo i.e the number of records of a file into log file so what i did was i did the ds job command and did a grep and cut command to get the num of records and here is my command
dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30
It works fine...
But my requirement is i need to append to a file in specified format ... so it shopuld be like
for ex:
Records : 72222
so what i did was i did like
print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filename
it not doing anyhting...
so i itred to put into a variable say
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
and do like printf 'Records : $var1' >> myfile.txt
it not doing any thing either the funny part is am not geeting any error either..Pls help me out.....
- This is not valid because you are passing the string Records: into the program dsjob.
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
- This depends on what shell you are using.
printf 'Records : $var1' >> myfile.txt
- You used single quotes.
What shell are you using? Do you want the string in variable or would simply using awk to add the "Recods: " suffice?
Re: DSJob command to a variable
I am using korn shell...... also i tried with the double qutoes it is not doing any thing for the var1.....Ultramundane wrote:print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filenameg_rkrish wrote:Hi
I am doing one script in which am trying to put the linfo i.e the number of records of a file into log file so what i did was i did the ds job command and did a grep and cut command to get the num of records and here is my command
dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30
It works fine...
But my requirement is i need to append to a file in specified format ... so it shopuld be like
for ex:
Records : 72222
so what i did was i did like
print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filename
it not doing anyhting...
so i itred to put into a variable say
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
and do like printf 'Records : $var1' >> myfile.txt
it not doing any thing either the funny part is am not geeting any error either..Pls help me out.....
- This is not valid because you are passing the string Records: into the program dsjob.
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
- This depends on what shell you are using.
printf 'Records : $var1' >> myfile.txt
- You used single quotes.
What shell are you using? Do you want the string in variable or would simply using awk to add the "Recods: " suffice?
Thanks,
RK
-
- Participant
- Posts: 407
- Joined: Mon Jun 27, 2005 8:54 am
- Location: Walker, Michigan
- Contact:
Re: DSJob command to a variable
That's because set is not doing what you expect. In Korn Shell "set" is used to create arrays or set certain session settings.g_rkrish wrote:I am using korn shell...... also i tried with the double qutoes it is not doing any thing for the var1.....Ultramundane wrote:print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filenameg_rkrish wrote:Hi
I am doing one script in which am trying to put the linfo i.e the number of records of a file into log file so what i did was i did the ds job command and did a grep and cut command to get the num of records and here is my command
dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30
It works fine...
But my requirement is i need to append to a file in specified format ... so it shopuld be like
for ex:
Records : 72222
so what i did was i did like
print 'Records :' | dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 >> filename
it not doing anyhting...
so i itred to put into a variable say
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
and do like printf 'Records : $var1' >> myfile.txt
it not doing any thing either the funny part is am not geeting any error either..Pls help me out.....
- This is not valid because you are passing the string Records: into the program dsjob.
set var1 = `dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30 `
- This depends on what shell you are using.
printf 'Records : $var1' >> myfile.txt
- You used single quotes.
What shell are you using? Do you want the string in variable or would simply using awk to add the "Recods: " suffice?
Thanks,
Get rid of the set and just do (make sure you no spaces before or after '='):
var1=`dsjob -linkinfo Projectname Jobanme stagename Linkname | grep 'Link Row Count'| cut -c18-30`
print "Records : $var1"