Search Results

Search: Posts Made By: black_fender
35,261
Posted By junior-helper
1. The actual reason why the output file test.txt...
1. The actual reason why the output file test.txt is empty is because the URL contains some special symbols, such as "&", which breaks the issued command. This can be fixed with proper quoting:...
3,419
Posted By Scrutinizer
Try: awk '....' Item="$targetItem"...
Try:
awk '....' Item="$targetItem" "$targetFile"
3,419
Posted By Don Cragun
You also need to go back to single quotes (or do...
You also need to go back to single quotes (or do some more escaping) so you can use awk's interpretation of $0 instead of the shell's interpretation of $0. And, if a line could every be a string...
3,419
Posted By Subbeh
You can try this in awk: awk '/measInfo/ || s...
You can try this in awk:
awk '/measInfo/ || s {s=s?s"\n"$0:$0} /<\/measInfo>/{if (s ~ /string1/) print s; s=""}' file

It saves the xml block in a variable and prints it when the tag is closed...
7,812
Posted By elixir_sinari
Oops, I must've been sleeping when I wrote...
Oops, I must've been sleeping when I wrote that!!!
Corrected and the required changes done in my earlier post.
3,483
Posted By elixir_sinari
With some sane input: awk...
With some sane input:
awk 'sub(/].*/,"")&&/^[0-9]/{print $0+0}' RS='[' file
3,483
Posted By pamu
as per your input.. this work fine. If not...
as per your input..

this work fine. If not please provide some more variations from your input file..:)

awk -F "[][]" '{ for(i=2;i<=NF;i+=2){if($i ~ /^[0-9]/){print "["$i"]"}}}' file
1,451
Posted By Scrutinizer
Assuming your field separator equals " | "...
Assuming your field separator equals " | " (space-pipe-space), try:
awk -F ' \\| ' '$2~/^10\.216\.22\.(XX|YY|ZZ)$/ && $4~/^[0-9]+$/' file
15,709
Posted By Scrutinizer
awk -F\| '$4~/[^0-9 ]/' file
awk -F\| '$4~/[^0-9 ]/' file
15,709
Posted By msabhi
awk -F\| '$4!~/^[0-9 ]+$/' input_file ...
awk -F\| '$4!~/^[0-9 ]+$/' input_file



JUST ANYTHING other than numbers....including special characters like $%^ etc
15,709
Posted By senthilkumark
Try this one awk -F\|...
Try this one

awk -F\| '{if($4~/[a-zA-Z]+/){print}}' filename
2,446
Posted By elixir_sinari
awk 'NR>=998;NR==1000{exit}' file sed -n...
awk 'NR>=998;NR==1000{exit}' file
sed -n '998,1000{;p;1000q;}' file
22,742
Posted By Franklin52
Try this: awk -F"|" '$2 ~ "REQUEST"...
Try this:
awk -F"|" '$2 ~ "REQUEST" {s=$0;f=1;next} f && $2 ~ "RESPONSE" {print s RS $0;f=0}' file
13,401
Posted By Scrutinizer
I know, but the OP was happy with the previous...
I know, but the OP was happy with the previous solution that did just that and so I thought that is what he meant. Otherwise he could use this:
sed 's/[^:]*://' infile
13,401
Posted By Scrutinizer
sed 's/.*://' infile
sed 's/.*://' infile
13,401
Posted By ahmad.diab
you can use nawk , awk , gawk: nawk -F":"...
you can use nawk , awk , gawk:


nawk -F":" '{print $NF}' infile > outfile
3,172
Posted By bakunin
This is the culprit. The "eval" sends the line...
This is the culprit. The "eval" sends the line through the evaluation process a second time, but the first time it has already eaten away your quotation and this second time the newline terminates...
6,218
Posted By bartus11
egrep '"GET .*\.gif' apache.log
egrep '"GET .*\.gif' apache.log
3,102
Posted By felipe.vinturin
Can't you escape the "-" before executing "grep"?...
Can't you escape the "-" before executing "grep"?

Check below:

$ text="-8x7YTVNk2KiuY-PWG5zzzjB-zzw"
$ string="-8x7YTVNk2KiuY-PWG5zzzjB-zzw"
$ echo "${text}" | sed 's/^-/\\-/g'...
3,102
Posted By itkamaraj
where is your echo statement ? can you post...
where is your echo statement ?

can you post the $string and $text values ?

---------- Post updated at 03:47 PM ---------- Previous update was at 03:45 PM ----------


$ echo "ab-cd-ef" |...
20,232
Posted By cero
To get this right: you want to assign the content...
To get this right: you want to assign the content of a variable that is set on your localhost to another variable on a remote host and want to determine which local variable to use during the...
20,232
Posted By ahamed101
Try this... $ var=bla $ result=$(ssh...
Try this...

$ var=bla
$ result=$(ssh -q user@remote-machine "
> echo \"this is var: $var \"
> var2=ggg
> echo \"this is var2 : \$var2 \"
> "
> )

Reason:- Since you are setting var2...
Showing results 1 to 22 of 22

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