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
Outlook 2007 will not connect to Exchange 2003 Server...however OWA works and email deliver is live on the Exchange server.
Vanished Partitions on Hard Disk
Internet Explorer won't open new window
DumpSec Help
OLE DB provider 'MSDASQL' reported an error. The provider did not give any information about the error.
XP Speaker Configuration - forced to 7.1 on boot?
Move From IIS6 to IIS7
Windows 2003 to 2003 R2 Upgrade.
Boot Magic Windows XP Pro and Windows 98SE switching to two hard drives
Watermark macro