Fetching data from file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fetching data from file
# 1  
Old 04-02-2014
Fetching data from file

Hi All,

I'm facing issue while using script.
Chk_Etl_Status=`cat /dstage/questnet/qnetdv/input/Etl_Status.dat|cut -d"," -f1`
echo Chk_Etl_Status=$Chk_Etl_Status

above result is giving me sometime value as 1 and sometime error message as
dsjoblaunch.sh[153]: test: Specify a parameter with this command.

---------------------Input values---------------------
Input file name--
$ cat Etl_Status.dat

Input filepath--
$ pwd


somebody pls look itno this. Am i writing some invalid script??

Last edited by Franklin52; 04-02-2014 at 03:23 AM.. Reason: Please use code tags
# 2  
Old 04-02-2014
If you could provide the entire scirpt, we can check for error...the above line looks file to me. You can also do that same thing with the below code
Chk_Etl_Status=$(awk '{print $1}' FS=',' /dstage/questnet/qnetdv/input/Etl_Status.dat)
echo Chk_Etl_Status=${Chk_Etl_Status}

This User Gave Thanks to SriniShoo For This Post:
# 3  
Old 04-02-2014
I tried ur command with slight modification:
Chk_Etl_Status=`cat /dstage/questnet/qnetdv/input/Etl_Status.dat | cut -d"," -f1`
echo Chk_Etl_Status=$Chk_Etl_Status

Just added space after file name and before cut. Even i tried ur code and that also works..
Probably as SriniShoo said please share the entire script..
This User Gave Thanks to temp_user For This Post:
# 4  
Old 04-02-2014
Why not
IFS=, read Chk_Etl_Status REST < /dstage/questnet/qnetdv/input/Etl_Status.dat

# 5  
Old 04-02-2014
Rudic-Are you sure the code you written is right??
# 6  
Old 04-04-2014
Well, it worked for me, reading the 1 from /.../Etl_Status.dat into Chk_Etl_Status.
What be your result, or problem?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fetching the required data out of a tabular form

Hello Gurus, I am trying to fetch a required number of lines from an output of a command which is in tabular form. Below is the command for reference along with how the result is being shown on UNIX shell. /usr/openv/volmgr/bin/vmquery -b -p 5 The result of the above command is as... (6 Replies)
Discussion started by: Ali Sarwar
6 Replies

2. Shell Programming and Scripting

Help with fetching the data from remote machine from my jumpbox(local machine)

Team, Presently i am running a script from my local box(i.e jumpbox) to all the remote machines.Basically fetching basic queries like pwd,mkdir,touch etc and i am able to successfully fetch it from my local machine.But when i want to check certain database related queries like the dbstat... (20 Replies)
Discussion started by: whizkidash
20 Replies

3. Shell Programming and Scripting

Fetching data particular data from the file.

Hi All, I have one fine which contaning the record as below, I need to fetch the number which is in Bold and from second line only URL need to pick. :ABCD C7QyzBXIs58k 1 fdmlksdlkfn ... (4 Replies)
Discussion started by: Riverstone
4 Replies

4. Shell Programming and Scripting

Problems with fetching data from Oracle database

Here's a database query which looks up the NAME column of PRODUCT table SELECT NAME FROM PRODUCT ; And this query retrieves me the following output SUGAR COCOA HONEY WHEAT CABBAGE CAULI FLOWER Please note the last record CAULI FLOWER contains TWO blank spaces between the two words. ... (4 Replies)
Discussion started by: kumarjt
4 Replies

5. Shell Programming and Scripting

help in fetching a field from a file

I have an input file with contents like : '1LTYSJSD2KQ8KLE' -audit_grp_id , internal error qty < recycle qty requested, skipping record '1LTYSJSD2KQ8KLE' -audit_group_id, 0 records has been written, 1 was skipped '1LTZLJRDFBEWJX9' -audit_grp_id , internal error qty < recycle qty requested,... (3 Replies)
Discussion started by: rkrish
3 Replies

6. Shell Programming and Scripting

Formatting Report and Reading data and fetching the details from contents file

Data I was trying to write shell script which will be return the output in the below format First i was trying to do these using sed. sed -n '/.ksh/p' mainksh.ksh sed -e 's/*\(.*\)/\1/g' mainksh.ksh $RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file. when i am... (0 Replies)
Discussion started by: rameshds
0 Replies

7. Shell Programming and Scripting

Fetching data from .csv file

Hi Experts, I have created a table with columns as empname,empid,phone,shiftname. Now I am having a .csv file format which contains the shift datas of the employees. I have to fetch this file and compare with the table I created to send an alert to the specified user. (2 Replies)
Discussion started by: micky3112
2 Replies

8. Programming

Problem FETCHing Long data type using CURSOR

Currently my Pro*c program is fetching a cloumn which is defined as LONG in oracle db. The data in the column is around 65k. But when I am FETCHing it to a varchar variable, I am only getting 22751 bytes of data using cursor. Is there any limitation on the data which is fetched by a cursor in... (2 Replies)
Discussion started by: manbt
2 Replies

9. Shell Programming and Scripting

Logs access in windows fetching the data from a unix server

How I can get the logs that are getting stored in specific location in unix server through an Apache web server installed in unix server? Requirement is to access the logs through the URL in windows browser without any access. (1 Reply)
Discussion started by: alvida
1 Replies

10. Shell Programming and Scripting

fetching data from sybase using perl

How can I fetch and retreive data(of each result set) of multiple result set from sybase by calling a stored procedure using perl DBI module on an unix solaris environment????? Please help (3 Replies)
Discussion started by: wadhwa.pooja
3 Replies
Login or Register to Ask a Question