Search Results

Search: Posts Made By: Klashxx
4,945
Posted By Scrutinizer
There is a limit (RE_DUP_MAX ) to the repetition....
There is a limit (RE_DUP_MAX ) to the repetition. In some sed's this seems to be rather low (255 or so). BSD sed does not cut it, GNU sed does..

$ sed 's/.\{320\}/&\
/g' infile
sed: 1:...
4,945
Posted By Yoda
Use fold instead: fold -c320 infile > outfile
Use fold instead:
fold -c320 infile > outfile
1,738
Posted By Scrutinizer
@sea: IFS can be used local to the read command: ...
@sea: IFS can be used local to the read command:
while IFS=\| read ColA ColB ColC ColD
do
...
done < file
So IFS does not need to be set and reset..
Note that ColA is empty, ColD contains...
3,058
Posted By Chubler_XL
If your using gnu awk you have @include: ...
If your using gnu awk you have @include:

@include "foo.awk"
{ print add($1, $2) }
2,001
Posted By Scott
If your grep supports -o, that's another option: ...
If your grep supports -o, that's another option:

$ grep -o "<a href[^>]*>" file
<a href='/misdownload/servlets/mirDownload?mimicKey=&doclookupId=317626164'>
3,801
Posted By summer_cherry
regular expression in perl is tailor-made for this kind of issue
while(<DATA>){
s/(?:[\[\]]|'(?=[^\[]*\]))//xg;
print;
}
__DATA__
"['1235','3234']","abcde","[1234]","['1235','3234']"
"'","abcde","[1235]","['1236','2234']"...
2,438
Posted By Don Cragun
If you have some options that take option...
If you have some options that take option arguments and some that don't, you'll find that getopts gives you lots of capabilities that the type of script provided in message #2 in this thread does not...
2,104
Posted By Scrutinizer
Actually the quotes are not necessary for the...
Actually the quotes are not necessary for the assignment:
value=$(cat file1.txt)


--
or if it is always just one line:
read value < file1.txt

or

IFS= read -r value < file1.txt
to...
3,931
Posted By Don Cragun
Some versions of awk provide a asort() and...
Some versions of awk provide a asort() and asorti() functions to sort data.
This example uses the sort utility to sort data and should work whether or not your version of awk has those functions. ...
21,383
Posted By Scrutinizer
Thanks alister... Another factor that might...
Thanks alister...

Another factor that might prove an important factor is which awk or which grep is used.
For example when using the same extended regex ^83 *(1[0-9][0-9][0-9]|2000)$
I got the...
21,383
Posted By alister
That's a reasonable assumption, but it turns out...
That's a reasonable assumption, but it turns out to be incorrect (at least with the implementation I tested).

In my testing, the following code is over three times faster than the original...
99,417
Posted By Scrutinizer
awk '{ORS=(ORS==RS)?FS:RS; print $NF}' infile
awk '{ORS=(ORS==RS)?FS:RS; print $NF}' infile
99,417
Posted By drl
Hi. An alternate with sed , cut , paste: ...
Hi.

An alternate with sed , cut , paste:
#!/usr/bin/env bash

# @(#) s1 Demonstrate combine lines fro specific column (field).

pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() {...
3,733
Posted By radoulov
awk -F\; 'END { for ( m = 0; ++m <= 3; ) ...
awk -F\; 'END {
for ( m = 0; ++m <= 3; )
printf "%s", h[m] FS
print "PARAM_HEADER", "PARAM_VALUE"
for ( j = 3; ++j < n; )
for ( i = 1; ++i <= NR; ) {
split( d[i], t )
...
Forum: What is on Your Mind? 03-14-2011
19,500
Posted By Neo
Please Donate to the Red Cross for Earthquake and Tsunami Relief in Japan
Dear Forum Members,

The UNIX and Linux Forums are working directly with the Red Cross to provide ad banners on our site to support Earthquake and Tsunami Relief in Japan. Registered users do not...
1,846
Posted By Scrutinizer
awk does not print, because tail -f does not...
awk does not print, because tail -f does not terminate, so awk clings to its buffers. Unfortunately, buffer control is not standard in awk. When using gawk, you can use fflush("") after a print...
3,954
Posted By fpmurphy
Another option would be to use quotemeta i.e. ...
Another option would be to use quotemeta i.e.

my $userInput = "[latency][info] mpgw(BLUESOAPFramework";
$userInput = quotemeta($userInput);

print "trans usrInput: $userInput\n";
if ( $str =~...
3,892
Posted By Scrutinizer
awk '/days_of_week/ && /start_times/ &&...
awk '/days_of_week/ && /start_times/ && !/date_conditions/{print $2}' RS= infile
1,625
Posted By alister
Klashxx's result is correct. However, a more...
Klashxx's result is correct. However, a more efficient way of calculating the result would be:
awk -v n=100 'BEGIN {while ((j=++i^2) <= n) print j}'

;)

If you think about the problem (forget...
Showing results 1 to 19 of 19

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