Search Results

Search: Posts Made By: newbie_01
2,798
Posted By RudiC
Why check for duplicate files if you can avoid...
Why check for duplicate files if you can avoid producing them in the first place? Try
$ touch filesdone
$ awk -vLCNT=10 -vPAT="CORRUPTION DETECTED" '
BEGIN {LCNT++
}...
2,798
Posted By jim mcnamara
IF you had mentioned your OS I could be sure of a...
IF you had mentioned your OS I could be sure of a better answer -
have you tried grep?

grep -A 10 -B 10 "CORRUPTION DETECTED" logfilename.log
is one way to it with many, but not all, OSes.
...
3,047
Posted By RudiC
No surprise. If the grep "command substitution"...
No surprise. If the grep "command substitution" delivers the "empty" value, ls-l uses the default: . . man ls:

Add a certainly non-existent file name (difficult to find, as there are almost no...
2,360
Posted By RudiC
That space is the OFS between $1 and $2. Try like...
That space is the OFS between $1 and $2. Try like


awk '
BEGIN {for (i=split("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC", month); i; i--) mdigit[month[i]] = i
}
{$1 =...
2,235
Posted By RudiC
Try $ awk -F\| '{split ($2, T, "="); $2 = T[1]...
Try
$ awk -F\| '{split ($2, T, "="); $2 = T[1] "=" tolower(T[2])} !a[$0]++' OFS=\| file
PROGRAM=JDBC Thin Client|USER=mickey|HOST=11.123.12.123|testmachine.xyz.com.zz



It converts just the...
1,002
Posted By RudiC
Your script seems a bit intricate. E.g. when...
Your script seems a bit intricate. E.g. when using the > redirection, you don't need to create / truncate the file upfront. And, with that many temp files, there must be a better approach. How far...
1,037
Posted By Don Cragun
Hi newbie_01, Maybe something like this would...
Hi newbie_01,
Maybe something like this would come closer to what you want. The other suggestions don't seem to convert the output to CSV format and don't seem to maintain the fixed-width fields...
1,037
Posted By itkamaraj
awk '{if(!a[$1 $2 $3 $4...
awk '{if(!a[$1 $2 $3 $4 $5]++){print}else{$1=$2=$3=$4=$5=$6=$7=$8="";print}}' filename
1,054
Posted By RudiC
Your attempt to sort -t"|" -k1 is not enough, as...
Your attempt to sort -t"|" -k1 is not enough, as (man sort)
, so -k1 is equivalent to no key at all. Try sort -t"|" -k1,1 file
1,914
Posted By Don Cragun
Hi newbie_01, There is no reason to feel small....
Hi newbie_01,
There is no reason to feel small. We're all here to learn. Next time you'll remember what you need to do.

Unfortunately you didn't tell us what operating system you're using. ...
1,914
Posted By Don Cragun
You're so close, just off by one character. When...
You're so close, just off by one character. When you use a character other than / as the delimiter in a BRE search pattern, you have to escape the first use of that character with a backslash (i.e.,...
587
Posted By MadeInGermany
The following versions are closer to the original...
The following versions are closer to the original and help to see the directories better:
find . | sed 's#[^/]*/#| #g; s#^\([| ]*|\) #\1--#'
find . | sed 's#[^/]*/#| #g; s#^\([| ]*\)| #\1+--#'
587
Posted By Corona688
Just do find -type f and you'll know that every...
Just do find -type f and you'll know that every top-level name you find is a file and everything beneath must be a folder, i.e. /path/to/filename
1,969
Posted By apmcd47
No, I think you did the right thing. You searched...
No, I think you did the right thing. You searched the forum for your problem, and now you are asking for a refinement, after finding your own solution, which you consider sub-optimal. I have to admit...
1,400
Posted By RudiC
There are several errors in your attempt. - the...
There are several errors in your attempt.
- the regex looks for strings with two adjacent _ in them; there is none in the input.
- parentheses lose their special meaning in the replacement and...
1,400
Posted By Don Cragun
The following seems to do what you want just...
The following seems to do what you want just using standard sed features:
sed 's#\(/db/LTS/abc\)p\(_.*\.dbf\)#\1t\2#' file > file.$$ &&
cp file.$$ file &&
rm file.$$
The \1 and \2 in the...
1,400
Posted By RudiC
Try sed -r...
Try
sed -r '\#(/db/LTS/abc)p(_.*dbf)$#s//\1t\2/' file


And, yes, the text colour selector (available in the "quick reply editor") seems to be missing in the "advanced editor". But with the bold...
1,571
Posted By bakunin
The following is probably not the answer you...
The following is probably not the answer you hoped for - i will tell you what you did do wrongly, why it was wrong and how you could do it better. You will still have to implement what i tell you...
1,372
Posted By RudiC
I'm afraid there's no "quick way" to do what you...
I'm afraid there's no "quick way" to do what you request. It has to be done like what you describe, line by line, value by value. Why don't you post your attempt to be discussed, analysed, and...
3,550
Posted By RudiC
Something along this line? awk -F\* ' ...
Something along this line?
awk -F\* '
{while (length($2) > 0) {T[++C] = substr ($2, 1, 20)
$2 = substr ($2, 21)
}
...
3,550
Posted By RudiC
When double quoting $line, the * chars will be...
When double quoting $line, the * chars will be preserved, and your awk scripts will work. Did you consider reading the variables immediately with bash ?

while IFS="*" read TS CS RS SV RC REST
...
3,550
Posted By vgersh99
-F'*' worked for gawk. What OS are you on? try...
-F'*' worked for gawk. What OS are you on?
try echo "$line"
Why do you need so many awk-s? Cannot you do it with just one?
1,626
Posted By Don Cragun
Hi newbie_01, I'm not as fluent in perl as Aia,...
Hi newbie_01,
I'm not as fluent in perl as Aia, but the following awk script seems to do what you want:
awk '
BEGIN { bpat = "^[[:blank:]]*$"
cpat = "^[cC][rR][eE][aA][tT][eE] "
corpat = cpat...
1,626
Posted By Don Cragun
So, just to be clear, are all of the following...
So, just to be clear, are all of the following true?:

All strings being matched are case insensitive.
If a line contains create starting is column 1, that string should be changed to CREATE or...
1,626
Posted By Aia
Hi, newbie_01, Do you have an objection to a...
Hi, newbie_01,

Do you have an objection to a non-liner?

#!/usr/bin/perl
# search_and_replace.pl
use strict;
use warnings;

my $blank;
my $reuse;
while (<>) {
s/CREATE/CREATE or...
Showing results 1 to 25 of 60

 

Featured Tech Videos

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