Search Results

Search: Posts Made By: sanantonio7777
5,119
Posted By Corona688
What's your system? What's your shell? This...
What's your system? What's your shell? This will be a lot harder in some shells than others, most can't directly turn a character into an integer value like that.

If perl is available I'd...
3,545
Posted By msabhi
oops wrong post--snipped
oops wrong post--snipped
3,545
Posted By Corona688
This splits every sentence. awk -v RS="."...
This splits every sentence.
awk -v RS="." '!/^\n$/ { print "<p>" $0 ".</p>" }' < input > output

This splits every 5 sentences.

awk -v RS="." '!/^\n$/ { if(!((++N)%5)) printf("</p>\n<p>");...
1,827
Posted By Corona688
And why are you trying to get all the lines from...
And why are you trying to get all the lines from your while loop into newvar1?

What are you actually trying to do? What is the function of that awk, there?

I am not diverting you or trying to...
1,827
Posted By Corona688
And why are you trying to get all the lines from...
And why are you trying to get all the lines from your while loop into newvar1?

What are you actually trying to do?

There may be more direct ways, is what I am thinking, if only I knew what you...
1,827
Posted By Corona688
It's because of the pipe. The while loop...
It's because of the pipe.

The while loop executes inside a subshell, and doesn't affect variables in the shell outside it.

What are you actually trying to do?
1,833
Posted By Corona688
If that's what you want, why not use the fold...
If that's what you want, why not use the fold command? fold -w 100 -s
1,833
Posted By elixir_sinari
An alternative: awk...
An alternative:
awk '{gsub(/.{100}/,"&^");n=split($0,a,"^");for(i=1;i<=n;i++) print a[i]}' inputfile

Assuming that "^" character does not appear in the input records.
4,116
Posted By Chubler_XL
You could try this: awk 'gsub(/^.*<div...
You could try this:

awk 'gsub(/^.*<div class="t0">/,"") && gsub(/<\/div>.*$/,"")'
4,116
Posted By rangarasan
Hi, Try gawk instead of awk. OS X has some...
Hi,

Try gawk instead of awk.
OS X has some different construct in awk. Just make try with gawk.
Cheers,
Ranga:-)
4,116
Posted By rangarasan
You have to use gensub for grouping. This will...
You have to use gensub for grouping.
This will works fine with GNU awk.
What is your OS?
4,116
Posted By rangarasan
Hi, Try this one, awk '{print...
Hi,

Try this one,

awk '{print gensub(/.*<div class="t0">(.*)<\/div>.*/,"\\1","g",$0);}' file

Cheers,
Ranga:-)
1,615
Posted By elixir_sinari
counts=${#myline} if [ $counts -gt 20 ] then...
counts=${#myline}
if [ $counts -gt 20 ]
then
echo "yes"
else
echo "NO"
fi
1,615
Posted By elixir_sinari
That if is outside the scope of the awk script......
That if is outside the scope of the awk script...
and I feel all of this can be done by a single awk command. But, I do not clearly know your intention/purpose.
2,833
Posted By alister
${#myline} will give you the length of myline. ...
${#myline} will give you the length of myline.

wc can count letters, words, and lines.

Regards,
Alister
2,833
Posted By rangarasan
perl
Hi,

Try this one,

echo ${myline} | perl -ne '$t=$_;$c=$t=~s/[^ ]\s+[^ ]//g;print "Words:$c\nLetters:",length($_),"\n";'

Cheers,
Ranga:-)
5,442
Posted By alister
That regular expression won't work as desired...
That regular expression won't work as desired even in GNU sed. *? in that regular expression is intended to be a non-greedy match. GNU sed regular expressions (basic and extended) do not support that...
Showing results 1 to 17 of 17

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