Search Results

Search: Posts Made By: mallak
2,310
Posted By vgersh99
awk -F, '{a[$1]=($1 in a)? a[$1] OFS $3:$3} END...
awk -F, '{a[$1]=($1 in a)? a[$1] OFS $3:$3} END {for (i in a) print "script" OFS a[i] OFS i}' myFile
1,701
Posted By askari
Another way in Perl language. Just for...
Another way in Perl language. Just for alternative solution,

#!/usr/bin/perl -w
# Usage: perl regex.pl file.log
use strict;

my $file = shift;
my $fh = undef;

open ($fh, '<', $file) or die...
1,701
Posted By CarloM
That's not particularly clear, I'm afraid. cat...
That's not particularly clear, I'm afraid.
cat <File name> | awk -F###<......>
if Day = Monday
then
We need to get TABSCHEMA1 and TABNAME1 in separate variables
Later
We use those...
1,701
Posted By Don Cragun
Please stop giving us one tiny piece of what...
Please stop giving us one tiny piece of what you're trying to do and tell us ALL of what you're trying to do. Help us help you!
awk -F 'FROM ' '
/MONDAY###/ && NF > 1 {
if(match($2, /[.][^ ]*...
1,701
Posted By Don Cragun
Yes, you can invoke sed inside awk, and yes, you...
Yes, you can invoke sed inside awk, and yes, you can invoke awk inside awk; but there is very seldom any reason to do so.

You have already been shown several ways to do what you requested in your...
1,701
Posted By Scrutinizer
sed -n 's/.*FROM \([^ ]*\).*/\1/p' file sed...
sed -n 's/.*FROM \([^ ]*\).*/\1/p' file
sed '/.*FROM /!d; s///; s/ .*//' file
1,701
Posted By clx
Try sed 's/.*FROM \([^ ][^ ]*\).*/\1/' file ...
Try

sed 's/.*FROM \([^ ][^ ]*\).*/\1/' file
or
awk '/FROM/ {getline;print;next}' RS=' ' file
1,701
Posted By RavinderSingh13
Hello, kindly use the code tags for any...
Hello,

kindly use the code tags for any commands or codes as per forum rules.
Also following code may help you in same.



awk -F"FROM " '{gsub(/[[:space:]].*/,X,$2); print $2}' File_name...
1,701
Posted By in2nix4life
awk '{match($0,/FROM (\w+\.\w+)/,a); print a[1]}'...
awk '{match($0,/FROM (\w+\.\w+)/,a); print a[1]}' infile
16,529
Posted By Franklin52
Something like this? awk '{ ...
Something like this?
awk '{
for(i=1;i<=NF;i++){
if($i ~ /apply_server/ || $i ~ /apply_schema/){
if(s){
s=s FS $i
} else {
s=$i
}
}
}
print...
16,529
Posted By agama
No, it will find the whole string apply_server=1;...
No, it will find the whole string apply_server=1; If you need it to find just the value after the equal, use this:


split( substr( $0, RSTART, RLENGTH ), a, "="); # split the token at the =...
16,529
Posted By agama
Sorry, misinterpreted your need. Maybe this...
Sorry, misinterpreted your need. Maybe this sample will give you what you need:


awk '
{
if( match( $0, "apply_server=.*[ \t]" ) ) # search the input line for the...
16,529
Posted By agama
Using the syntax $(i) will allow you to access a...
Using the syntax $(i) will allow you to access a column using the contents of a variable, in this case 'i'.


#!/usr/bin/env ksh
awk -v col=${1:-1} ' {print $(col)}'


This example accepts a...
Showing results 1 to 13 of 13

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