Search Results

Search: Posts Made By: owwow14
2,969
Posted By Don Cragun
It looks like there is a mismatch between the...
It looks like there is a mismatch between the Locale that was used when creating the file and the Locale used when running your awk script.

Try running your awk script again with the LC_CTYPE...
1,629
Posted By disedorgue
Hi, Try: awk '{for (i=2;i<=NF;i++ ) print...
Hi,
Try:
awk '{for (i=2;i<=NF;i++ ) print $1,"\t",$i}' file
Regards.
4,394
Posted By anbu23
$ awk -F"\n" -v RS="</s>\n" ' { print NR,NF-2 } '...
$ awk -F"\n" -v RS="</s>\n" ' { print NR,NF-2 } ' file
1 5
2 6
4,394
Posted By RavinderSingh13
Hello owwow14, Following may also help you...
Hello owwow14,

Following may also help you in same.

awk '/<s>/{getline;while($0 !~ /<\/s>/){A++;getline};print A;A=""}' Input_file


Output will be as follows.

5
6


Thanks,
R....
4,394
Posted By vgersh99
awk -f ow.awk myFile where ow.awk is: $0 ~...
awk -f ow.awk myFile where ow.awk is:

$0 ~ "<s>",$0~"</s>" {c++}
$0 ~ "</s>" {print c-2;c=0}
4,394
Posted By RudiC
Any attempts from your side? ---------- Post...
Any attempts from your side?

---------- Post updated at 17:21 ---------- Previous update was at 17:16 ----------

Be it as it may... this one is not too daunting. Try awk '/<s>/ {ST=NR}...
1,862
Posted By RavinderSingh13
Hello owwow14, Could you please try...
Hello owwow14,

Could you please try following, not tested though.


awk '{if($1 !~ /[[:punct:]]/ && $1 !~ /[[:digit:]]/) {print $0}}' Input_file


Thanks,
R. Singh
1,517
Posted By Corona688
awk can write to whatever file you please. ...
awk can write to whatever file you please.

awk 'L && (L != FILENAME) { close(L) }
{ L=FILENAME }
{$(NF+1)=1 ; print > L ".new" }' *

This will create "filename.new" for each "filename" fed...
3,177
Posted By RavinderSingh13
Hello owwow14, Here is an awk approach for...
Hello owwow14,

Here is an awk approach for same.


awk 'FNR==NR{A[$1]=$0;next} ($1 in A){print A[$1]}' fileA fileB


Output will be as follows.


adventures com|hum
adversity ...
1,211
Posted By RavinderSingh13
Hello owwow, Following may help. ...
Hello owwow,

Following may help.


awk '($4 ~ /^N.*/){$2=$2"-x"} 1' OFS="\t" filename


Output will be as follows.


1 HOW-x _ NNP NNP _ 3 nn _...
9,328
Posted By RudiC
Try awk 'NF==0 {next} $1==1 && NR>1 {print...
Try awk 'NF==0 {next} $1==1 && NR>1 {print "\n"}1' file
2,140
Posted By Scrutinizer
You could modify your awk like this: awk...
You could modify your awk like this:
awk '!NF{print; next}{print $4 "\t" $1 "\t" "-" "\t" $2 "\t" $3 "\t" "-" "\t" $5 "\t" $6 "\t" "-" "\t" "-"}' FS='\t' file

or

awk '!NF{print; next}{print...
14,694
Posted By rbatte1
Try using $0 instead:- awk '{print $0 "\t"...
Try using $0 instead:-
awk '{print $0 "\t" "1"}' file


Does that give you what you need?


Robin
14,694
Posted By RudiC
Try awk '{$(NF+1)=1}1' file pvb 1 2 3 4 5...
Try awk '{$(NF+1)=1}1' file
pvb 1 2 3 4 5 ....... 300 1
fdh 3 4 5 2 4 ...... 300 1
dfk 2 3 4 2 6 ...... 300 1
1,634
Posted By Don Cragun
It seems that you only want to change the last...
It seems that you only want to change the last character on each line, but you don't restrict the search REs to match EOL and three of your substitutions are missing closing slashes. Try:
sed...
5,810
Posted By Makarand Dodmis
Hi Yoda, If possible could you please...
Hi Yoda,

If possible could you please explain your code line by line.
What this A[++c] will stores .. like this...

Regards,
5,810
Posted By Yoda
awk ' { A[++c] = $1 ...
awk '
{
A[++c] = $1
}
END {
for ( i = 1; i <= c; i++ )
{
for ( j = 1; j <= c; j++ )
...
1,897
Posted By SriniShoo
Can you please explain more...because, from the...
Can you please explain more...because, from the data you shown above, how do you get the result you provided for identical cols 1 & 2.
Anyways, if you want unique col 1 & 2
awk '! a[$1 $2]++'...
12,810
Posted By Lucas_0418
If you do not mind to grep four times, this may...
If you do not mind to grep four times, this may could help you.

TP=`grep -c "1[[:blank:]]\{1,\}1$" infile`
TN=`grep -c "0[[:blank:]]\{0,\}0$" infile`
FN=`grep -c "0[[:blank:]]\{0,\}1$" infile`...
12,810
Posted By bakunin
No, there isn't: grep is for filtering lines...
No, there isn't: grep is for filtering lines according to some rules, usually a regexp. What grep can do is: return all lines which exhibit a certain pattern. What grep cannot do: summarize content....
811
Posted By neutronscott
sed 's/+/ /' file replaces first + to a...
sed 's/+/ /' file


replaces first + to a space...
811
Posted By Scrutinizer
Hi, try: sed 's/+/ /' file
Hi, try:
sed 's/+/ /' file
811
Posted By Franklin52
Something like this? awk '{sub("+"," ")}1 '...
Something like this?
awk '{sub("+"," ")}1 ' file
1,853
Posted By RavinderSingh13
Hello, Following may help also. ...
Hello,

Following may help also.


awk 'NR==FNR{a[$2]++;next} ($2 in a){if(a[$2] > 1) print $0}' file_name file_name



cat big 24
cat red 63
dog big 34
fish red 294


...
1,853
Posted By Akshay Hegde
$ awk 'FNR==NR{A[$2]++;next}A[$2]>1' file file ...
$ awk 'FNR==NR{A[$2]++;next}A[$2]>1' file file
cat big 24
cat red 63
dog big 34
fish red 294


edit *I just see yoda's approach and mine are same
Showing results 1 to 25 of 57

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