Search Results

Search: Posts Made By: ahsog
7,433
Posted By ahsog
this is insane! I've run the same command many...
this is insane!
I've run the same command many times (at least I thought so).
Never mind, it works as expected.
Thanks
7,433
Posted By ahsog
perl string matching problem (two backslash)
I have a few .tex files generated with html2latex. They have some extra \\ that generate error with pdflatex, so I would like to get rid of them.
This
perl -p -i -e s/\\\\//g myfile.tex
with or...
8,524
Posted By ahsog
I thought this was a very trivial thing, but I...
I thought this was a very trivial thing, but I see it is not. devtakh's solutiong gives me the same result I had with sed, but that gives columns of different width.
aigles' solution seems to be...
8,524
Posted By ahsog
Ok, it seems I'm getting there. Telling...
Ok, it seems I'm getting there. Telling explicitly the width of the wider (wider than a tab) column, I get an aligned table.
BEGIN {
FS=","
}
{printf "%s\t%-40s\t%s\n", $1,$2,$3}
But isn't...
5,978
Posted By ahsog
no, sorry again, it works, for some mistyping an...
no, sorry again, it works, for some mistyping an extra '}" was in the script, so it did not work.
So, finally it works.
Thank you again.
8,524
Posted By ahsog
something like this: Header one Header two ...
something like this:
Header one
Header two
Header three
col1 col2 col3
short datavery long data data
5,978
Posted By ahsog
no, sorry, it is still not right, now the 'š'...
no, sorry, it is still not right, now the 'š' goes to the very end of the sorting:
aaa&ccc&ddd
aaa&bbb&ccc
aaa&aaa&bbb
bbc&aaa&aaa
cab&&
lmn&bbb&aaa
mmn&aaa&ccc
saš&&
sss&&aaa
tuaa&&...
8,524
Posted By ahsog
csv to table one-liner
I've googled a lot on this, but could not fine a simple one-liner to do this.
I have a .csv file that looks like this:
Header one
Header two
Header three
col1,col2,col3
short data, very long...
5,978
Posted By ahsog
I have perl 5.8.8 on unix Works great! I did...
I have perl 5.8.8 on unix
Works great! I did not know you have to tell perl to use utf8.
Thanks a lot!
5,978
Posted By ahsog
well, I'm not a programmer, so I don't know if...
well, I'm not a programmer, so I don't know if I'm able to define a custom locale right now, but of course I'm willing to learn if there's no other option. But isn't the line:
$in =~...
5,978
Posted By ahsog
perl sort unicode non-ascii letters
In another thread (field separator in Perl) I nearly solved my sorting problem and I finally understood the Schwartzian transform especially thank to KevinADC. After that I've found out that the...
24,534
Posted By ahsog
ok kevinadc, thanks a lot for you time, you've...
ok kevinadc, thanks a lot for you time, you've been of great help!
;)
24,534
Posted By ahsog
No, sorry, the original code has 'ū', what I...
No, sorry, the original code has 'ū', what I wanted to ask is why you put 'ū' in the first and 'u' in the second.
$in =~ tr<aeiouū>
<aeiouu>;
And also wanted to ask, if I change this
...
24,534
Posted By ahsog
Yes, actually, it is something I wanted to ask,...
Yes, actually, it is something I wanted to ask, because putting 'ū' in the left side would not work, but it does work like this (with two "normal" 'u' . Why is that?
24,534
Posted By ahsog
Cool! With this code for example: use strict; ...
Cool! With this code for example:
use strict;
use warnings;
open (_file_, "< /home/sw/zza") or die "Failed to read file : $! ";
my @not_sorted = <_file_>;
sub normalize {
my @in = @_;
...
24,534
Posted By ahsog
Thanks a lot, I haven't had time to try it this...
Thanks a lot, I haven't had time to try it this day, I'm way too busy, but what does this mean:

I had to add this because otherwise Perl would not sort proerly "u" and "ū"
24,534
Posted By ahsog
would it look like this? I did not try it yet. ...
would it look like this? I did not try it yet.
map {chomp; [$_,normalize((split(/\&/))[0,1,2])]} @not_sorted;
24,534
Posted By ahsog
Now I understand. Although I don't need it...
Now I understand.
Although I don't need it right now, what if I wanted to sort by second column or third ect.? And why does Perl by defalut store only the first column as [1], and trips away the...
24,534
Posted By ahsog
Thank you KevinADC, but I still cannot fully...
Thank you KevinADC, but I still cannot fully understand, and especially, quirkasaurus seems to be at least in part right. If I use [1] in the sort line everything goes fine, but if I use this:
use...
24,534
Posted By ahsog
does this mean that the sort line will always...
does this mean that the sort line will always have [1] or that it should be one number higher than the map line? eg. map [0] sort [1]; map [1] sort [2]
24,534
Posted By ahsog
I'm starting to understand. But please explain...
I'm starting to understand.
But please explain me the use of [1] and [0]:
sort{ $a->[1] cmp $b->[1]}
map {chomp; [$_,normalize((split(/\&/))[0])]} @not_sorted;
I find it a bit...
24,534
Posted By ahsog
:( I take everything back, it still does not...
:(

I take everything back, it still does not work. I tried to change [1] to [2] to see if it sees the "&", but I got this:

Use of uninitialized value in string comparison (cmp) at zs line 14,...
24,534
Posted By ahsog
Solved
I've finally got the thing to work. Thank you all.
Here's the code.
use strict;
use warnings;
open (_file_, "< path-to-file") or die "Failed to read file : $! ";
my @not_sorted = <_file_>;...
24,534
Posted By ahsog
Thank you again. For some reason, I didn't even...
Thank you again. For some reason, I didn't even think of custom sorting in my database (postgres), I'll check it out. But since I have to do some changes on the file when it comes out, I thought to...
24,534
Posted By ahsog
Thank you all. To tell the truth, I'm getting...
Thank you all. To tell the truth, I'm getting quite confused. I think I have to do some serious reading of the man pages, because I still cannot figure out how to make this split work with my posted...
Showing results 1 to 25 of 32

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