Search Results

Search: Posts Made By: gary_w
834
Posted By gary_w
Stating what database and shell you are using...
Stating what database and shell you are using would help, but since that info is not here...

Here's a couple of ways. First, try putting put a TRIM( ) function call (or your system's equivalent)...
91,948
Posted By gary_w
If sed chokes on it perl may be a better choice.
If sed chokes on it perl may be a better choice.
915
Posted By gary_w
sed 's/\(.\{78\}\)_\(.*\)/\1\2/' x.dat ...
sed 's/\(.\{78\}\)_\(.*\)/\1\2/' x.dat
N-{[3,4-dihydroxy-5-(hydroxymethyl)oxolan-2-yl]amino}(2-hydroxyphenyl)carboxamide


Search for 78 instances of any character (and remember it), followed by...
3,690
Posted By gary_w
Note that RudiC's method counts the word if it is...
Note that RudiC's method counts the word if it is part of another word. I do not know if this is the desired result as the original spec did not get that detailed. Just sayin'.
3,690
Posted By gary_w
#!/bin/ksh FILE1=x1.dat FILE2=x2.dat ...
#!/bin/ksh

FILE1=x1.dat
FILE2=x2.dat

while read word
do
# -w option to grep for searching on a word boundary.
count=$( grep -wc "$word" $FILE2 )
printf "%s: %d\n" "$word" $count...
925
Posted By gary_w
Another way using sed. Match any number of...
Another way using sed.

Match any number of numbers between single quotes:
sed "s/'[0-9]*'/'1100000001'/" fileor match 10 numbers in a row:
sed 's/[0-9]\{10\}/1100000001/' file
7,923
Posted By gary_w
Remove the parens around: ...
Remove the parens around:
COMMANDS=("${AIX_COMMANDS[@]}")
1,883
Posted By gary_w
Ah, I believe I misunderstood you in what data...
Ah, I believe I misunderstood you in what data you needed. For the sake of completeness then here is my fixed sed solution:


$ cat x.dat
<SOAP...
1,320
Posted By gary_w
Works on Solaris via PuTTY emulating a vt100...
Works on Solaris via PuTTY emulating a vt100 terminal:

$ cat x
#!/bin/bash

# Define terminal escape sequences.
GREEN="\033[1;32m" # bold, green
NORM="\033[0m"

text="A cat is on a cat...
10,547
Posted By gary_w
For the fun of it here's another way that does...
For the fun of it here's another way that does not use awk although the awk version will be more efficient. This has the overhead of creating the pipeline repeatedly which should be avoided for good...
Forum: Programming 10-16-2012
4,672
Posted By gary_w
Have a look at this. Using union merges the...
Have a look at this. Using union merges the queries together and sorts them. Logically this is not what you asked for though. Your example was getting a row on either side of the target value. ...
2,086
Posted By gary_w
Please see my amended post above.
Please see my amended post above.
896
Posted By gary_w
Try searching for "here document" instead. ...
Try searching for "here document" instead.

Anyway, cat is reading from standard in (STDIN) and displaying the text line by line. Just like this:

$ echo hello | cat
hello
$
You are just...
2,335
Posted By gary_w
From left to right: sed -n...
From left to right:
sed -n "s/.*_\([0-9]\{8\}\).*\.jar$/\1/p"
sed - Stream editor
-n - Suppress normal action which is to print all lines
"s/ - Start search/replace pattern
. - Match...
1,174
Posted By gary_w
Is the minus always the last character on a line?...
Is the minus always the last character on a line?

grep '\-$' x.dat >> minus.txt
11,302
Posted By gary_w
Try this for running SQL/Plus in a co-process to...
Try this for running SQL/Plus in a co-process to reduce overhead. I modified an existing example script I had created to illustrate using the co-process. It could use some error handling but you...
915
Posted By gary_w
Set a variable called TEMP to the value of the...
Set a variable called TEMP to the value of the variable PATH_PROC_USER if PATH_PROC_USER has a value. If PATH_PROC_USER does not have a value (is null), set Temp to a null string (the ""). Which is...
5,978
Posted By gary_w
This works. Note Rule_Severity is null to test: ...
This works. Note Rule_Severity is null to test:
$ cat x
#!/bin/sh

Group_ID='V-4269-1'
Group_Title='Unnecessary Accounts, Games.'
Rule_ID='SV-4269-lr4_rule'
Rule_Severity=""...
30,531
Posted By gary_w
Works fine for me using ksh and bash when run...
Works fine for me using ksh and bash when run from both command line and nohup'ed. What is your shell? if you are using the bourne shell, the "$( )" command substitution syntax is not supported. ...
8,384
Posted By gary_w
Append to an existing file using two greater than...
Append to an existing file using two greater than signs:
command >> out.txt
A single greater than sign will clear the file before use if the file already exists.
14,334
Posted By gary_w
This little example should show you output that...
This little example should show you output that stays on one line:
$ cat x
#!/bin/ksh

integer i=0

while [[ $i -lt 10 ]]; do
##
## \r = carriage return
## \c = suppress linefeed
##
...
103,883
Posted By gary_w
Yes I believe the Bourne shell (sh) does not...
Yes I believe the Bourne shell (sh) does not support arrays. Are you able to run my complete example? Make sure to include the first line, it tells whatever your login shell is to use the korn shell...
2,051
Posted By gary_w
Consider taking a look at "Advanced Programming...
Consider taking a look at "Advanced Programming in the UNIX(R) Environment"

Amazon.com: Advanced Programming in the UNIX(R) Environment (Addison-Wesley Professional Computing Series)...
Forum: Fedora 05-08-2012
6,042
Posted By gary_w
Doh, good catch! Good lesson! :o
Doh, good catch! Good lesson! :o
Forum: Fedora 05-07-2012
6,042
Posted By gary_w
If you are using bash, or ksh93, nothing special...
If you are using bash, or ksh93, nothing special is required:
$ cat x

#!/bin/bash

a=1.3
b=2.4

echo "$a+$b" | bc


exit 0

$ x
3.7
$

---------- Post updated at 03:08 PM ----------...
Showing results 1 to 25 of 80

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