Search Results

Search: Posts Made By: neelmani
2,211
Posted By Scrutinizer
Sure: /(.*select/!N if the line consists of...
Sure:
/(.*select/!N if the line consists of a "(" followed by "select" then do not append the next line to the buffer..
//p repeat the previous match operation ( "(" followed by...
2,211
Posted By Scrutinizer
sed -n '/(/{/(.*select/!N;//p;}' infile
sed -n '/(/{/(.*select/!N;//p;}' infile
2,211
Posted By elixir_sinari
My bad. Try a slight modification: sed -n...
My bad.
Try a slight modification:
sed -n ':strt
/([[:space:]]*select/{;p;b;}
/([[:space:]]*$/{;N;b strt;}' file
3,333
Posted By Ygor
Try...$ cat file1 : select col1 , col2 from...
Try...$ cat file1
:
select col1 , col2 from /* selecting columns from the table1 */ table1;
:
/* etc1
etc2
*/
:
select col1 , col2
from /* selecting columns from the table1 */...
20,142
Posted By guruprasadpr
Hi Re-direct the output to a temporary...
Hi

Re-direct the output to a temporary file, and then rename the file to the original one:

tr -d '\015' <y.sql >x.sql
mv x.sql y.sql

Guru
20,142
Posted By guruprasadpr
Hi It has to be like Zaxxon mentioned: ...
Hi

It has to be like Zaxxon mentioned:

tr -d '\015' <y.sql >x.sql

Guru.
20,142
Posted By zaxxon
This is asked very often - you can use the search...
This is asked very often - you can use the search function of the forum to get a solution/alternative.
Not sure why your dos2unix complains, but you can try this:

tr -d '\015' < winfile > unixfile
4,863
Posted By elixir_sinari
I assume that you meant "variable" instead of...
I assume that you meant "variable" instead of "file".

In that case, try


word="as"
awk "/^$word$/{print p}{p=\$0}" file
4,863
Posted By rangarasan
awk
we are storing the previous value in p variable and using whenever required.
4,863
Posted By elixir_sinari
Just tweaking the previous solution a bit to get...
Just tweaking the previous solution a bit to get the correct results:


awk '/^as$/{print p}{p=$0}' file
4,863
Posted By rangarasan
Awk
Hi,

Try this one,

awk '/as/{print p;}{p=$0;}' file

use nawk instead of awk if you dont have awk.
Cheers,
Ranga:-)
2,699
Posted By Scrutinizer
/usr/bin/grep is not the POSIX compliant version...
/usr/bin/grep is not the POSIX compliant version on Solaris. POSIX compliant versions of utilities can be found in /usr/xpg4/bin or /usr/xpg6/bin
2,699
Posted By Scrutinizer
@neelmani: Use /usr/xpg4/bin/grep instead of...
@neelmani:
Use /usr/xpg4/bin/grep instead of grep
2,699
Posted By Scrutinizer
Try -x for whole line match.. # is not a word...
Try -x for whole line match.. # is not a word character and therefore sachin is considered a word...
1,006
Posted By bartus11
Perl command will work in your shell, you just...
Perl command will work in your shell, you just have to have Perl installed (which it is in 99% of the cases). Anyway, here is some AWK:
awk '/table1/{getline;if ($0==",") {getline;print}}' file.txt
2,763
Posted By donadarsh
try it this way. capture the process id of sub...
try it this way.
capture the process id of sub process and keep checking for completion in a loop after some interval.

wrapper.ksh
########################
#!/bin/ksh

nohup ./pii_insert.ksh...
1,266
Posted By Corona688
They are all in the same folder that way, but...
They are all in the same folder that way, but they don't have to be. You could as easily do relative/path/script.sh & or /absolute/path/to/script.sh &.

And yes, it will work in KSH. It will work...
1,266
Posted By Corona688
#!/bin/sh ./bg1.ksh & # One & on the end...
#!/bin/sh

./bg1.ksh & # One & on the end means 'run it in the background'.
./bg2.ksh &
wait # This will wait for both of them to finish.

./test2.ksh # This one gets run in the foreground.
2,616
Posted By Scrutinizer
awk OK? /usr/xpg4/bin/awk -Fproc_name '{print...
awk OK?
/usr/xpg4/bin/awk -Fproc_name '{print substr($1,length($1),1) substr($2,1,1)}'

sed:
sed 's/.*\(.\)proc_name\(.\).*/\1\2/; s/^proc_name\(.\).*/\1/; s/.*\(.\)proc_name$/\1/;...
3,083
Posted By Scrutinizer
Yes..
Yes..
2,616
Posted By Scrutinizer
Try: perl -pe 's/.*?(.?)proc_name(.?).*/$1$2/'
Try:
perl -pe 's/.*?(.?)proc_name(.?).*/$1$2/'
3,083
Posted By bakunin
Two ways: 1. display the content of the...
Two ways:

1. display the content of the (system)-variable "${.sh.version}". This is from my system:

# print ${.sh.version}
Version JM 93t+ 2010-03-05

2. switch to "vi"-command line editing...
2,906
Posted By itkamaraj
$ nawk -v RS=""...
$ nawk -v RS="" '{for(i=1;i<=NF-1;i++)if($i~/FROM/){print $(i+1)}}' input.txt
(SELECT
rrdwst00.TRWBE_ALLOC_REDEMPTION_FACT
4,601
Posted By itkamaraj
$ echo ",table2.col2,tableone.column1," | nawk...
$ echo ",table2.col2,tableone.column1," | nawk -F, '{for(i=1;i<=NF;i++){if($i~/\./){split($i,a,".");print a[1]}}}'
table2
tableone
Showing results 1 to 24 of 28

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