Search Results

Search: Posts Made By: durden_tyler
2,308
Posted By nezabudka
echo {a..e}{a..e}{a..e} | xargs -n1
echo {a..e}{a..e}{a..e} | xargs -n1
628
Posted By bakunin
sed -e 's/JAN_DAT_(.*\)\_([0-9]\{10\}\).*.csv/\1...
sed -e 's/JAN_DAT_(.*\)\_([0-9]\{10\}\).*.csv/\1 \2/g'

The first thing is: sed-patterns are always "greedy", which means they match the longest possible part of the line. A pattern like A.*B will...
2,157
Posted By bakunin
It does so for a reason because it is not...
It does so for a reason because it is not advisable to use the "-i" switch at all, even in the few versions of sed not adhering to the standards which have it, because the the standards also do NOT...
900
Posted By Don Cragun
Hi durden_tyler, The macOS pbpaste command...
Hi durden_tyler,
The macOS pbpaste command writes whatever was last copied into the paste buffer. If the selected text included a trailing <newline>, a trailing <newline> will be included in the...
981
Posted By wbport
One other option: sed -n "/...
One other option:
sed -n "/ [+-]*[0-9]*\.[0-9][0-9]* / p" hello.outIt writes nine lines given Durden's last example of hello.out.
2,364
Posted By jim mcnamara
Andy200 - please do not edit your posts after...
Andy200 - please do not edit your posts after someone answers. You can no longer post to this thread.

Thanks you for understanding that what you were doing is extremely unhelpful to the folks...
1,300
Posted By jim mcnamara
aia - correct and simpler. Not necessarily good...
aia - correct and simpler. Not necessarily good for someone obviously new to perl to get what is going on.

I often post 'long' versions of something so that each step is clear. Your example is...
859
Posted By Don Cragun
That will work with some versions of awk and give...
That will work with some versions of awk and give you a syntax error with other versions of awk. The following should work with almost any version of awk:
awk '{$1=$1; print>("file"NF)}'...
661
Posted By Scrutinizer
Or: sed '/_ABC$/s/^DSCAPP123#/PRDAPP123#/;...
Or:
sed '/_ABC$/s/^DSCAPP123#/PRDAPP123#/; /_RW$/s/^DSCAPP123#/PDDAPP123#/'
661
Posted By RudiC
Or sed '/_ABC$/ s/^DSC/PRD/; /_RW$/...
Or
sed '/_ABC$/ s/^DSC/PRD/; /_RW$/ s/^DSC/PDD/' file
PRDAPP123#XYZ_A0015_ABC
PDDAPP123#XYZ_BC00034_RW
1,555
Posted By Scrutinizer
-- This also sorts the header, putting it...
--


This also sorts the header, putting it on an undefined line number. So the shell logic for skipping the header, which assumes it to be on the first line, will not function as intended (it...
1,664
Posted By Scrutinizer
Try : awk 'p==s{gsub(qr,x); gsub(fs,ORS,$1);...
Try :
awk 'p==s{gsub(qr,x); gsub(fs,ORS,$1); print $1}{p=$NF}' s=BUNLOES fs=mgg qr="'|\"" RS== file


--
@SkySmart: you just changed the specification in post #15, by introducing random single...
885
Posted By bakunin
Generally: commands in one-liner style do not...
Generally: commands in one-liner style do not enhance the readability all too much. If you don't understand it it is a good idea to first write it out, like i have done:


sed -n '/{/ ! b ...
1,704
Posted By Corona688
Or, in short, show the data you have, and then,...
Or, in short, show the data you have, and then, show the data you want, and explain how they're related.
3,342
Posted By bakunin
Precisely because of that. In fact,...
Precisely because of that.



In fact, you can do whatever you want, but the error won't go away otherwise.



As you have been told: because the man page says so. But there is a deeper...
Forum: Programming 02-04-2016
2,086
Posted By Corona688
OK, that was weird. wrap...
OK, that was weird.

wrap *wrap=malloc(sizeof(wrap));

This, folks, is why you don't ever name your variable the same name as a type.

size of structure: 4K and a bit.
size of...
825
Posted By Aia
Hi, durden_tyler Nice work, however your...
Hi, durden_tyler

Nice work, however your output is a bit off of what it is wanted if I am interpreting correctly.


Your output: S 40149.00 47897.00 1V1 0.0 0 0.0 453310.8...
1,555
Posted By Don Cragun
Other than the fact that you have eliminated...
Other than the fact that you have eliminated spaces in your |T and .T "records" and now have variable length records in the lines between the ?T "records", this is extremely similar to your last...
3,251
Posted By drl
Hi. Something similar using a CPAN module,...
Hi.

Something similar using a CPAN module, adapted from the examples:
#!/usr/bin/env perl

# @(#) p3 Demonstrate module Math/Combinatorics.

use Math::Combinatorics;

my ( $min, $max ) = (...
10,736
Posted By Scott
A semi-colon is missing: $ sed...
A semi-colon is missing:

$ sed '/^.AR/{s/AR/yyy/; s/.$//;}' f01
Forum: What is on Your Mind? 05-06-2013
2,804
Posted By Corona688
The deep dark secret of high-level languages is...
The deep dark secret of high-level languages is that, even if you treat C/C++ as a dark-ages language and eschew it for java/python/shell/CAML/INTERCAL, nearly all the "Good Stuff" your programs...
Forum: Programming 11-02-2012
1,878
Posted By Neo
I agree with Corona688. Don't use remote...
I agree with Corona688.

Don't use remote sites like pastebin to attach code here.

Code should be uploaded to this site and not foreign sites.

After this post, I'm proposing a new rule to...
Forum: Programming 12-19-2011
1,881
Posted By alister
Linux, to be pedantic, is just a kernel. You can...
Linux, to be pedantic, is just a kernel. You can find the source for that @ The Linux Kernel Archives (http://www.kernel.org/). However, that does not include all of the bits that make a linux...
4,580
Posted By yazu
perl -0777 -F'/\n\n+/' -ane ' ...
perl -0777 -F'/\n\n+/' -ane '
print join "\n\n",
map { $_->[1] }
sort { $a->[0] cmp $b->[0] }
map { [(split /\n/)[0], $_] } @F; ...
5,729
Posted By radoulov
perl -le' @str = qw( ab% %%abc %ab%c%...
perl -le'
@str = qw(
ab% %%abc %ab%c% %a%b%c% ab%c ab%%%%%c ab%%c
);

do {
$cnt = tr/%//; push @{$cnt{$cnt}}, $_;
$min = $cnt unless defined $min and $cnt > $min;
...
Showing results 1 to 25 of 26

 

Featured Tech Videos

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