Search Results

Search: Posts Made By: kchinnam
6,729
Posted By Chubler_XL
You could write a load-prop function that...
You could write a load-prop function that replaces all non-alphanumeric characters in the variable names with underscore like this:


#!/bin/bash
function load-prop {
. <(
awk '
FNR==NR...
1,590
Posted By RudiC
Try (not thoroughly tested): find . -type f | ...
Try (not thoroughly tested):
find . -type f |
awk -F\/ '
{PTH = $0
sub (/\/[^/]*$/, _, PTH)
IX = $NF~/^ERROR/?"ERROR":$NF~/^Runtime/?"RUNTM":"OTHER"
CNT[IX...
6,785
Posted By RudiC
You said you wanted to "Extract multiple values...
You said you wanted to "Extract multiple values into corresponding variables". Depending on your shell, this might work:
IFS=, read BN BD BS <<< $(awk '{A[$1]=$NF} END{print A["Build_SvnRev:"],...
6,785
Posted By MadeInGermany
With shell builtins while IFS=": " read key val...
With shell builtins
while IFS=": " read key val
do
val=${val%$'\r'}
case $key in
Build_Number) BN=$val;;
Build_SvnRev) BS=$val;;
Build_Date) BD=$val;;
esac
done < file
echo...
6,785
Posted By Scrutinizer
Hi, try: awk '{A[$1]=$NF} END{print...
Hi, try:

awk '{A[$1]=$NF} END{print A["Build_SvnRev:"], A["Build_Number:"], A["Build_Date:"]}' OFS=, file

--
If there are CR (Windows) characters in the input file you could:
awk...
1,467
Posted By Don Cragun
You define a variable named prefix. You expand a...
You define a variable named prefix. You expand a variable named myprefix. Try:
prefix='myprefix'; echo "chr, aaaaa|bbbbbb" | sed "s/^/$prefix,/"
which produces the output:
myprefix,chr,...
2,473
Posted By Don Cragun
If I correctly understand what you're trying to...
If I correctly understand what you're trying to do (and I am not at all sure that I do), try:
awk '/key2/ || /key3/{print $2,$3; next}1' fileor:
awk '/key[23]/{print $2,$3; next}1' file
As always,...
1,078
Posted By Don Cragun
First consider the following script stored in a...
First consider the following script stored in a file named tester:
#!/bin/bash
IAm=${0##*/}

var1="""
Custom JAX-RS
$IAm
Custom Shared
$(who am I)
Web 2.0
"""

var2="
Custom JAX-RS
$IAm...
2,632
Posted By RudiC
Try also awk '$1 != LAST {printf "%s%s", DL,...
Try also
awk '$1 != LAST {printf "%s%s", DL, $1; LAST = $1; DL = RS} {printf ",%s", $2} END {print _}' FS=, file
jvm01, Web 2.0 Feature Pack Library, IBM WebSphere JAX-RS, Custom01 Shared Library...
2,632
Posted By RavinderSingh13
Hello kchinnam, Could you please try...
Hello kchinnam,

Could you please try following.

awk '{Q=$1} #### Assigning $1's value to a variable named Q here.
($1 in A) #### Checking if $1(first field) is already present in...
1,922
Posted By Aia
$ENV{var} is the facility that Perl has to...
$ENV{var} is the facility that Perl has to interact with shell environment variables. Another way is to pass them as command line parameters, but in order to do that you have to write more...
8,932
Posted By Don Cragun
One might guess that perl is used frequently on...
One might guess that perl is used frequently on your system and awk is used infrequently. If that is the case, perl will always be in your cache (and will get consistent timings) while after a few...
8,932
Posted By Don Cragun
Maybe you want something like: awk ' BEGIN...
Maybe you want something like:
awk '
BEGIN { dqsERE = "\"[^\"]*\""
EREs[++nEREs] = " jndiName=" dqsERE
EREs[++nEREs] = " baseQueueName=" dqsERE
EREs[++nEREs] = " name=" dqsERE
for(i = 1; i...
8,932
Posted By Aia
I asked you if it would work, because...
I asked you if it would work, because <factories.*baseQueueName appeared to me, quite a long regex to verify a line. However, if you really need it, grep is not necessary.
perl -nle...
1,686
Posted By Don Cragun
Note that awk statements take the form: ...
Note that awk statements take the form:
condition {action}
where condition is evaluated for each input line and, if it yields a value of TRUE or a non-zero numeric value or a non-empty string...
1,686
Posted By Don Cragun
In the code I suggested: awk ' BEGIN { cmd =...
In the code I suggested:
awk '
BEGIN { cmd = "sort -t/ -k1.8,1n -k6.5,6n"
}
/<li>/ {print | cmd
next
}
/<\/ul>/ {
close(cmd)
}
1' file.html
the 1 shown in red at the end of the awk code...
2,034
Posted By Don Cragun
You could also try this awk script. It can...
You could also try this awk script. It can handle single-quoted strings, double-quoted strings, and unquoted strings terminated by a space or ">". It requires an equal-sign (with optional leading...
2,034
Posted By Aia
The following produces the same result that you...
The following produces the same result that you posted for MIN_HEAP and MAX_HEAP

MIN_HEAP=$(perl -ne 'print /initialHeapSize[ \x27"=]+(\d+)/' server.xml)
echo $MIN_HEAP
256
MAX_HEAP=$(perl -ne...
10,595
Posted By Don Cragun
You haven't said what operating system or shell...
You haven't said what operating system or shell you're using, but for things like this I usually use awk. This seems to do what you want:
#!/bin/ksh
strear='myapp1-ear'

awk -v...
7,213
Posted By RudiC
That's the awk process itself. It should not be...
That's the awk process itself. It should not be matched due to the [r] brackets. Are you sure you used above command pipe?

Add a 1 between closing brace and closing quote and post the result.
7,213
Posted By Chubler_XL
The quotes around "EOF" are important, they stop...
The quotes around "EOF" are important, they stop this local-side expansion of the $() command substitution eg:

$ hostname -s
MyPC

$ ssh MyServer <<EOF
echo $(hostname -s)
EOF
MyPC

$...
2,370
Posted By Don Cragun
Assuming that neither the path you want to...
Assuming that neither the path you want to replace nor the replacement path contain any characters that are special in a regular express AND that the path you want to replace is the some number of...
2,370
Posted By Aia
I wonder if this is what you are after. sed...
I wonder if this is what you are after.

sed "s|\(^LoadModule jk_module \).*$|\1$newpathA|"
sed "s|\(^JkWorkersFile \).*$|\1$newpathB|"
sed "s|\(^JkLogFile \).*$|\1$newpathC|"
1,545
Posted By Corona688
:confused: No. nohup / myscript.sh don't open...
:confused: No. nohup / myscript.sh don't open the file -- your shell does, before anything else is even run. They just use the file you opened for them.
18,444
Posted By Chubler_XL
The line v{v=v"\n"$0} translates to: if v has a...
The line v{v=v"\n"$0} translates to: if v has a value assigned then append current line to v

This causes the script to ignore all lines until a "-----BEGIN" line is seen, at which point v is set...
Showing results 1 to 25 of 38

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