Search Results

Search: Posts Made By: BeefStu
1,328
Posted By Yoda
awk '{$(NF-2)="("$(NF-2)")"}1'...
awk '{$(NF-2)="("$(NF-2)")"}1' file
2,106
Posted By Don Cragun
If you are using a Korn shell newer than the 1988...
If you are using a Korn shell newer than the 1988 version, replace:
if [[ "$variable" = @(ORA|ERROR|SP2) ]]with:
if [[ "$variable" == *@(ORA|ERROR|SP2)* ]]if you want to match ORA, ERROR, or SP2...
1,392
Posted By Corona688
$ awk -F'>' -v VAR="OS_User" -v RS='<' '/[/]/ {...
$ awk -F'>' -v VAR="OS_User" -v RS='<' '/[/]/ { next }; ($1 == VAR) { print $2 }' data
majohn1

$

awk -F'>' -v VAR="OS_User" -v RS='<' '($1 == VAR) { print $2 }' data > /tmp/$$
while read...
1,392
Posted By bartus11
First occurrence:perl -lns0e...
First occurrence:perl -lns0e '/$tag>([^<]+)/;print $1' -- -tag=$var file
All occurrences:perl -lns0e 'while (/$tag>([^<]+)/g){print $1}' -- -tag=$var file
Last occurrence:perl -lns0e 'while...
60,176
Posted By Corona688
It finds files inside $AUDIT_DIR with the...
It finds files inside $AUDIT_DIR with the extension xml, aud, or txt. I don't think negative numbers make any sense here -- they're not mentioned in find's documentation, so I think it'd either look...
1,263
Posted By CarloM
sed 's/(.*//' (replace '(' followed by 0 or...
sed 's/(.*//'
(replace '(' followed by 0 or more of any char with nothing)
5,202
Posted By itkamaraj
awk -F\" '{print $2}' inputfile
awk -F\" '{print $2}' inputfile
1,373
Posted By Corona688
How to set the values is easy. ARR[$VAR]=$VALUE ...
How to set the values is easy. ARR[$VAR]=$VALUE

How you get the data depends entirely on what you're doing.
1,479
Posted By Ygor
Try...awk '$1=="Name:"{print $2,$3,$4,$5;...
Try...awk '$1=="Name:"{print $2,$3,$4,$5; getline; print $4; getline; print $3}' /tmp/xxx | paste - - -
7,154
Posted By alister
In that example, it should work fine if you...
In that example, it should work fine if you double-quote the variable.

If you want to ensure that the value of the variable is matched literally, use fixed-string matching, -F, to disable regular...
1,535
Posted By bartus11
Is Perl OK?perl -F"," -nae...
Is Perl OK?perl -F"," -nae '$F[0]=~s/TO_DATE\((.*)/TIMESTAMP\1)\n/;print $F[0]' file
or shorter:perl -pe 's/TO_DATE\(([^,]+).*/TIMESTAMP\1)/' file
1,479
Posted By yazu
sed 's/^ *//' INPUTFILE | perl -00 -ne...
sed 's/^ *//' INPUTFILE |
perl -00 -ne '/:\s*(.*)\n.*:\s*(\d+).*:\s*(\d+)/s && print "$1 $2 $3\n"'
1,881
Posted By vgersh99
echo '/u01/app/oracle/diag/rdbms/ifddb1/ifddb1' |...
echo '/u01/app/oracle/diag/rdbms/ifddb1/ifddb1' | sed 's#.*/diag/#diag/#'
1,322
Posted By radoulov
You could remove the redirect inside func2: ...
You could remove the redirect inside func2:

zsh-4.3.11[t]% cat t1.ksh
#!/bin/ksh
func2()
{
diff /tmp/jdlkwjdlkejew /tmp/djlkwejdlewdjew
}

func1()
{
let counter=0
while [ $counter...
11,520
Posted By vgersh99
what's the opposite of 'newer'? Older? find...
what's the opposite of 'newer'? Older?

find /path/to/files -type f ! -newer dummy -exec ls -l {} \;
1,632
Posted By vgersh99
Does it have to be sed? echo '27-MAR-2011...
Does it have to be sed?

echo '27-MAR-2011 10:28:01 * (CONNECT_DATA=(SID=dmart)(CID=(PROGRAM=sqlplus)(HOST=mtasnprod1)(USER=mtasnord))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.197.7.47)(PORT=54881)) *...
8,297
Posted By Chubler_XL
just use: tar cvf /tmp/file.tar .
just use:
tar cvf /tmp/file.tar .
11,204
Posted By vbe
https://www.unix.com/answers-frequently-asked-quest...
https://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
11,204
Posted By jim mcnamara
result=$( /usr/bin/perl -w -e ' use strict; ...
result=$(
/usr/bin/perl -w -e '
use strict;
use POSIX;
print strftime "%Y-%m-%d %H:%M:%S\n", localtime((time() - 7200)); '
)

echo "$result"


perl -e '[command goes here]' is for an...
1,926
Posted By Chubler_XL
umask dosn't set execute bit on files (ie file...
umask dosn't set execute bit on files (ie file permissions start with 666 directories with 777)

so for files666 AND NOT 022 = 644

In Binary:
110110110
111101101 AND
----------
110100100...
1,874
Posted By DGPickett
The ksh end chewers are pound on the nose and get...
The ksh end chewers are pound on the nose and get a percentage in the end. Twice is aggressive.

x=/a/b/c/d
${x##*/} is d (chew nose aggressive anything to slash)
${x%/*} is /a/b/c (chew end...
11,064
Posted By Scott
$ awk -F"[ =]" '/DESCRIPTION/ { print X }{ X=$1...
$ awk -F"[ =]" '/DESCRIPTION/ { print X }{ X=$1 }' tnsnames.ora
PRI
STDBY
AIXSNAP
2,919
Posted By Franklin52
man test [ -t 0 ] checks if the stdin in the...
man test

[ -t 0 ] checks if the stdin in the given script is a terminal.
[ -t 1 ] checks the stdout.
Showing results 1 to 23 of 23

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