I am new to shell scripting. Need help with the below requirement.
I need help to read a log file and line containing word ORA needs to be captured into a variable and the values of the variable need to be inserted into a table.
I need to captured this entire line starting from ORA till logon denied. Any error starting from ORA need to be assigned into a variable and to be inserted into a table.
I tried below command:
The above command gave me below output:
I want the first line starting from ORA and that line needs to be inserted into table.
Hi,
I have a parameter file and it contains following items
$ cat TransactionParams
From_Date_Parm=2005-02-25
To_Date_Parm=2005-05-25
Extract_Root_Parm=/detld1/etl/ascential/Ascential/DataStage/Projects/CTI_London/IAM
Extract_Type_Parm=Transaction
EDW_Database_Parm=hdw_erks... (2 Replies)
Hi all,
I have a problem here. I have a file and let we take the content of the file is just '32' (only a numeric value in that file). Now I need to assign this numeric value ( value in that file) to a variable. Is that possible? If so, can you plz advice me on this?
Thanks in... (4 Replies)
Hi! I'm trying to assign line numbers to each line of the file
for example consider the following..
The contents of the input file are
hello how are you?
I'm fine.
How about you?
I'm trying to get the following output..
1 hello how are you?
2 I'm fine.
3 How about you? ... (8 Replies)
Hi All,
I have been using a program on windows called AutoKey.
My environment at work is Linux and I have been experimenting with expect. Very powerful. I can move my AutoKey scripts to Linux using Expect once I am educated on how to read from a file using Expect.
My application would be... (1 Reply)
I am trying to assign a string of numbers with their decimals to a variable. The code reads a file called 'log'. I have not included the entire file since it's huge.
The line is:
Tagging release with the label program-2.8.114...My code:
BUILDNUMFORSIT=$(egrep 'Tagging release with the... (3 Replies)
Hello Gurus,
Here is my requirement. I need to find the number of lines in a file and need to assign it to a variable. This is what I did and not wroking.
#!/bin/ksh
set -xv
Src_Path=/mac/dev/Generic/SrcFiles
Src_Count=wc -l ${Src_Path}/FILE_JUNE.txt
Count_file = $Src_Count | awk -F... (2 Replies)
Hello,
I am using below code for reading from a file and assigning the values to a variable , but it is loosing the value after the loop , please suggest to retain the value of the variable after the loop ,
while IFS=: read -r line
do
set $dsc=$line
echo 'printing line variable ' $line... (1 Reply)
Hi All,
I need to read two config files in a shell script. In that I need to assign a value from one config file to another. I 'm using bash.
config_env.txt
prefix=tab_
config_properties.txt
table_name=${prefix}account
So, when I read these two files in a shell script, I need... (6 Replies)
Discussion started by: shash
6 Replies
LEARN ABOUT HPUX
read
read(1) General Commands Manual read(1)NAME
read - read a line from standard input
SYNOPSIS
var ...
DESCRIPTION
reads a single line from standard input. The line is split into fields as when processed by the shell (refer to shells in the first field
is assigned to the first variable var, the second field to the second variable var, and so forth. If there are more fields than there are
specified var operands, the remaining fields and their intervening separators are assigned to the last var. If there are more vars than
fields, the remaining vars are set to empty strings.
The setting of variables specified by the var operands affect the current shell execution environment.
Standard input to can be redirected from a text file.
Since affects the current shell execution environment, it is usually provided as a normal shell special (built-in) command. Thus, if it is
called in a subshell or separate utility execution environment similar to the following, it does not affect the shell variables in the
caller's environment:
Options
recognizes the following options:
Do not treat a backslash character in any special way.
Consider each backslash to be part of the input line.
Opperands
recognizes the following operands:
var The name of an existing or nonexisting shell variable.
EXTERNAL INFLUENCES
Environment Variables
determines the internal field separators used to delimit fields.
RETURN VALUE
exits with one of the following values:
0 Successful completion.
>0 End-of-file was detected or an error occurred.
EXAMPLES
Print a file with the first field of each line moved to the end of the line.
while read -r xx yy
do
printf "%s %s
" "$yy" "$xx"
done < input_file
SEE ALSO csh(1), ksh(1), sh(1), sh-posix(1).
STANDARDS CONFORMANCE read(1)