Search Results

Search: Posts Made By: ysrini
4,296
Posted By Corona688
This string: ". /tmp/bin/myenv.sh; echo...
This string: ". /tmp/bin/myenv.sh; echo ${LOG_DIR}" substitutes ${LOG_DIR} before su is run. Use single-quotes ' ' instead to prevent it from substituting.
11,590
Posted By alister
That code is vulnerable to pattern matching...
That code is vulnerable to pattern matching metacharacters. For this approach to work with arbitrary text, it is necessary to double-quote the nested parameter expansion.

$ s=*****a
$ echo "$s"...
11,590
Posted By bakunin
You need to understand how "variable expansion"...
You need to understand how "variable expansion" works: lets assume we have a variable assigned (i suggest you try the examples yourself at the shell prompt and play around a bit with them to get...
4,900
Posted By gary_w
I'll bite: find . -type f ! -perm 554 -exec...
I'll bite:
find . -type f ! -perm 554 -exec chmod 554 {} \;
15,263
Posted By Corona688
If you want pure POSIX compliance, use pure...
If you want pure POSIX compliance, use pure POSIX, not KSH. Pure POSIX shell code will work in SH and KSH, while things using KSH features(arrays, etc) might only work in KSH...
15,263
Posted By Scrutinizer
Kornshell 88 is not 100% POSIX compliant Try...
Kornshell 88 is not 100% POSIX compliant

Try to run it as sh:
#!/usr/bin/sh
# (I think it is in /usr/bin or was it #!/bin/posix/sh ??)
It will still use ksh, but it should emulate a POSIX...
44,255
Posted By agama
I think either of these are acceptable in Ksh or...
I think either of these are acceptable in Ksh or bash depending on your preference/need for single or double bracketed expressions:


if ! [ $1 == "foo" ] || [ $1 == "bar" ]
then
echo true...
3,008
Posted By codemaniac
Associative arrays are just live savers in these...
Associative arrays are just live savers in these needs

awk '{arr[$1]++}END{for (i in arr) {print i "-" arr[i]}}' uniq.dat
3,008
Posted By jayan_jay
sort < infile | uniq -c
sort < infile | uniq -c
3,008
Posted By agama
You can try this: awk '{c[$1]++;} END {...
You can try this:


awk '{c[$1]++;} END { s=""; for( x in c ){ printf( "%s%s=%d", s, x, c[x]); s=","; } printf( "\n" ); }' input-file
4,431
Posted By guruprasadpr
paste -s -d, f1.txt Guru.
paste -s -d, f1.txt

Guru.
23,175
Posted By alister
A translation into sed: sed -n 'H; /^CHECK/h;...
A translation into sed:
sed -n 'H; /^CHECK/h; ${g;p;}' f1.txt

Regards,
Alister
4,504
Posted By agama
If you turn off 'printing' by default (-n) and...
If you turn off 'printing' by default (-n) and then put a print command after your address pair, it will work as you intended.


sed -n '/START2/,/STOP/p' input-file
2,699
Posted By balajesuri
user~$ PARM='V01' user~$ grep -A1...
user~$ PARM='V01'
user~$ grep -A1 '^\$'$PARM'\$' f1.txt
$V01$S
this is 1

If you still want a sed, here's one:
sed -n '/\$'$PARM'\$/{N;p;}' f1.txt
2,902
Posted By jayan_jay
Try in this way .. $ cat infile ...
Try in this way ..

$ cat infile
1|2|3|4|5|6|7
$
$ a='$2 $3 $4'
$
$ echo $a
$2 $3 $4
$
$ echo "awk -F\| '{print $a}' infile" | sh
234
$
2,358
Posted By curleb
You'd really need to base it upon some evaluation...
You'd really need to base it upon some evaluation that you can control. You'd test the inputs, and based on behavior, you'd fork off in whatever direction you need. The following function provides...
11,199
Posted By vgersh99
Not all of your records/lines have the same...
Not all of your records/lines have the same number of columns/fields as stated in the header.
Try this:

BEGIN {
n=split(fld, t, " ")
for(i=1;i<=n;i++)
fldN[t[i]]
}
FNR==1{
...
Showing results 1 to 17 of 17

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