Microsoft
Software
Hardware
Network
Question : Find and Copy string from text file in Korn Shell script KSH
Hi
Im trying to search a text file for a certain string then grab text around it and create a new text file withy the copied text.
I attached the text file...also:
--------------------------
-------
Here is an example of the text file:
--------------------------
----------
******
TESING LOGIN FOR USER: PLDB
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
******
******
TESTING LOGIN FOR USER: OUTLN
'CONNECTE
---------
CONNECTED
******
--------------------------
-----
I basically need to search for each occurrence of the word CONNECTED then I need to grab the text above it that says : " TESING LOGIN FOR USER: OUTLN "
Answer : Find and Copy string from text file in Korn Shell script KSH
variable="USER: "`awk '/USER:/{u=$NF}
/CONNECTED/{print u}' $INFILE`
echo $variable
Random Solutions
Query Update Runs Automatically
Trouble Importing a .bak File From Another SQL Server Installation
In Python a class seemgingly proper will yield a name 'SampleClass' is not defined error when run
1004: Application-defined or object-defined error on QueryTable refresh
get process working directory
Error adding Vista client to SBS 2003 - nshelp.exe odd error
Random emails are getting stuck in the outgoing exchange que. If I force the connection most will go but then it happens again.
Need code for a dropdown date selector in asp.net javascript. That does not postback to the server.
Date and Time will not stay current
Install DBI and DBD on a Windows NT machine