Search Results

Search: Posts Made By: gayathree
5,189
Posted By Scrutinizer
Bash does support piping into read but the read...
Bash does support piping into read but the read is in a subshell, so that when the read ends the variables are lost... You can do something like this:

awk '$1=="ALTER" && $4="ADD" { print $3, $5,...
5,189
Posted By protocomm
var1=$(awk -F "[<>]" '{print $2}'...
var1=$(awk -F "[<>]" '{print $2}' file);var2=$(awk -F "[<>]" '{print $4}' file);var3=$(awk -F "[<>]" '{print $6}' file)
5,189
Posted By agama
Most efficient if you use Ksh: awk '{if(...
Most efficient if you use Ksh:


awk '{if( $1=="ALTER" && $4="ADD" ) print $3, $5, $6 }' file | read table column type


Bash dosen't support piping int read like this so the only way I know...
5,189
Posted By guruprasadpr
Hi # cat a ALTER TABLE abc ADD empid char ...
Hi

# cat a
ALTER TABLE abc ADD empid char
# awk '{if($1=="ALTER" && $4="ADD"){print "var"++i"="$3"\n" "var"++i"="$5"\n" "var"++i"="$6}}' a
var1=abc
var2=empid
var3=char
#

Guru.
5,189
Posted By agama
This should give you enough of an idea of how to...
This should give you enough of an idea of how to write the script. This example assumes Ksh (Korn shell) as bash has issues with piping command output to read into variable names.

...
2,864
Posted By agama
Really impossible to give any suggestions without...
Really impossible to give any suggestions without a sample of what you need to parse. Please post ten lines or so of the input text that you'll need to parse, and exactly what portions of the data,...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy