Search Results

Search: Posts Made By: ooilinlove
1,693
Posted By disedorgue
Here, it should not be value "keyword1" is equal...
Here, it should not be value "keyword1" is equal to "8" by example...

Regards.
1,693
Posted By Scrutinizer
I don't know what you mean Disedorgue. My script...
I don't know what you mean Disedorgue. My script does not compare "keyword1" to "8"
I added the output of the command in my post, which is what the OP required.
1,693
Posted By vgersh99
awk -f oo.awk myFile, where oo.awk is: BEGIN...
awk -f oo.awk myFile, where oo.awk is:

BEGIN {
FS=OFS=","
f2r=10
split("24,8,0",fA,FS)
split("Keyword1,Keyword2,Keyword3", fAr,FS)
}
FNR>1{
for(i=1; i in fA;i++)
if ($f2r ==...
1,693
Posted By Scrutinizer
Try: awk '$10==24{$10="keyword1"}...
Try:
awk '$10==24{$10="keyword1"} $10==8{$10="keyword2"} $10==0{$10="keyword3"}1' FS=, OFS=, file
Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17...
1,693
Posted By disedorgue
Hi, try: awk -F,...
Hi, try:
awk -F, 'BEGIN{OFS=FS;A[0]="keyword3";A[8]="keyword2";A[24]="keyword1"};A[$10] ? $10=A[$10] : 1' input.txt

Regards.
2,237
Posted By Yoda
Similar to Scott's approach, but using...
Similar to Scott's approach, but using Associative Arrays (https://en.wikipedia.org/wiki/Associative_array) in KSH93:
#!/bin/ksh

typeset -A ARR
while read line
do
(( ARR["$line"]++ ))...
2,237
Posted By Scott
$ awk '{ A[$0]++ } END { for( a in...
$ awk '{
A[$0]++
}

END {
for( a in A )
printf "%-40s : %5d\n", a, A[a]
}' file1
Back-end User state is invalid : 2
Back-end Invalid Id Password : 9...
1,965
Posted By Franklin52
Another one: awk...
Another one:
awk 'NR==FNR{a[$1]=$2;next}{FS="@";$4=a[$4]}1' OFS="@" match_log.txt All_service.txt
1,965
Posted By bartus11
This should work (but I'm writing it from top of...
This should work (but I'm writing it from top of my head, without access to machine with AWK or Linux/Unix):cat match_log.txt | tr -s " " | awk -F"@" 'NR==FNR{split($0,a,"...
1,524
Posted By kurumi
#!/usr/bin/env ruby h={};h.default="" ...
#!/usr/bin/env ruby
h={};h.default=""
File.readlines("file").each{|v| g=v.split;h[g[1]]=g[0] }
File.open("file1").each do |line|
sp=line.split("฿")
h.has_key?(sp[1]) and...
1,524
Posted By frans
This should do the job (strange separator) ...
This should do the job (strange separator)
#!/bin/bash
IFS='฿'
while read A B C
do
D=$(grep -m1 $B 'My match data.log' | cut -d' ' -f1)
echo "${A}฿${D}฿$B฿$C"
done < 'My log.txt'
1,524
Posted By rdcwayx
awk ' NR==FNR{a[$2]=$1;next} { ...
awk '
NR==FNR{a[$2]=$1;next}
{
split($0,b,"฿")
if (b[2] in a) sub(b[2],a[b[2]]"."b[2])
}1' date.log log.txt
Showing results 1 to 12 of 12

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