Microsoft
Software
Hardware
Network
Question : Unix Script for Reading text file line by line
OK. I need help in unix scripting.
I have attached a sample file. Here are my queries.
1. Read the text file line by line. So there should be 5 lines to be read
2. Find t.mgmt_sa_code='TRADERA' and capture TRADERA in variable.
3. Save each line in a separate file. For e.g. the first line of the file will be saved with a filename TRADERA.sql. So 5 lines means 5 files should be saved when the program is completed
Please provide the script which can do the above.
I believe it should be simple.
Thanks,
ajexpert
Answer : Unix Script for Reading text file line by line
The above was a ksh script,
below is a bash script
#!/usr/bin/bash
while read line ; do
f=${line#*t.mgmt_sa_code="
'"}
echo $line > ${f%"'";*}.sql
done < sample.txt
Random Solutions
How do I install the Citrix Presentation Server ICA Client
VBA Macro - Outlook 2007 Quick Category PIck Box Macro
priv1.stm size, exchange 16 gb limit
Informix : Subtract minutes from datetime
Relink Backend Programmatically
Follow or NoFollow affiliate links?
Protocol Driver Error - XenApp Plugin 11 with XenApp 5 on Windows 2008 x86
Any idea on how to extract swf from excel and power point presentation (please explain in layman terms)
Automatically Enable Macros
Setting up Visual Web Developer Express & IIS 7 on Vista.