Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: birei
1,118
Posted By birei
Hi Daniel Gate, One way using perl: $...
Hi Daniel Gate,

One way using perl:

$ cat infile
..........................................................................................................................
...
4,066
Posted By birei
Hi MIA651, One way using perl. It prints the...
Hi MIA651,

One way using perl. It prints the file name, a colon and the number of characters in last line:
$ perl -lne 'if ( eof ) { printf qq|%s: %d\n|, $ARGV, length; }' *
3.txt: 12
AAAB.txt:...
971
Posted By birei
Hi Boomn4x4, You were near. Here a code that...
Hi Boomn4x4,

You were near. Here a code that works:

$ cat script.pl
#!/usr/bin/env perl

use warnings;
use strict;
use Data::Dumper;

my $result = <<'EOF';
Statistics 0
...
Forum: Programming 11-29-2012
1,811
Posted By birei
Hi sam05121988, Beacuse your are...
Hi sam05121988,

Beacuse your are incrementing the i counter in every line. You should do it every two lines. Otherwise you will have empty slots in the array that print that warning message. Like:...
926
Posted By birei
Hi hcclnoodles, I don't know why you could...
Hi hcclnoodles,

I don't know why you could want to do that. I'm sure it is a red flag in your program. Said that, here there is one way:

$ cat script.pl ...
1,202
Posted By birei
Are you kidding me? I've done three diferent...
Are you kidding me?

I've done three diferent versions of a script to solve your problem althought your specifications were not clear since the first post. I did some effort to help you, and now...
1,202
Posted By birei
Yes. There are many ways but the easiest one is...
Yes. There are many ways but the easiest one is to use a XML parser. I don't know the available tools of your server so it's your decission. But take into account that process XML data with sed or...
1,295
Posted By birei
Hi Mr.Smith, One way: $ cat infile ...
Hi Mr.Smith,

One way:

$ cat infile
/mediawiki-1.19.0/index.php/RickJames !!add new line here!!
/mediawiki-1.19.0/index.php/Sabaton
some url
$ perl -pe 's{\A(\Q/mediawiki-1.19.0\E)}{\n$1}'...
7,833
Posted By birei
Not awk. But here you have one solution using...
Not awk. But here you have one solution using XML::Twig parser in perl:

$ cat xmlfile
<root>
<Target>
<SeqNo>43156489079</SeqNo>
...
1,202
Posted By birei
Try following solution. Now the script accepts...
Try following solution. Now the script accepts two arguments. The first one is a file with a number per line, and the second one is the xml file:

$ cat infile
98
12
$ cat script.pl...
1,202
Posted By birei
I don't know why you changed the text of the...
I don't know why you changed the text of the bottom. It's not inside <Text Id="98">. Give a try to:

$ cat script.pl ...
1,202
Posted By birei
A solution to your problem using perl and the...
A solution to your problem using perl and the module XML::Twig:

$ cat infile
<root>
<Text Id="98">
<Language id="1">Su saldo es $mainAccountBalance1Tiene ademas...
1,202
Posted By birei
Hi Ashu_099, 1.- Replace? with what? 2.-...
Hi Ashu_099,

1.- Replace? with what?
2.- That xml file is not well formed.
3.- Show sample output to get more helpful answers.
Forum: Programming 11-21-2012
1,376
Posted By birei
Show us the qx command and add the following...
Show us the qx command and add the following instruction just before the grep:

print "@rooms";
Forum: Programming 11-21-2012
1,376
Posted By birei
Where does it fail?
Where does it fail?
Forum: Programming 11-21-2012
1,376
Posted By birei
Hi ab52, It's qx without quotes, like: ...
Hi ab52,

It's qx without quotes, like:

my @rooms = qx($ssh comand);
1,403
Posted By birei
Hi abhi_123, Use sed. Add it at the end of...
Hi abhi_123,

Use sed. Add it at the end of the pipe chain:

... | sed -e 's|^.*/||'
881
Posted By birei
Hi anuragpgtgerman, What is the result of ...
Hi anuragpgtgerman,

What is the result of

print "(($a))\n";
just before the open instruction?
2,226
Posted By birei
Hi pioavi, One way using perl and the module...
Hi pioavi,

One way using perl and the module XML::Twig.

$ cat infile ...
1,103
Posted By birei
Some questions: 1.- Has each user an...
Some questions:

1.- Has each user an <postupdate> entry?
2.- Where do you get user's data? From <mapped>, from <joined> or from anywhere else?
1,103
Posted By birei
Hi prvnrk, I'm afraid that you will have to...
Hi prvnrk,

I'm afraid that you will have to be more specific. I see several names attributes with an operation of delete next to it, not only legacyExchangeDN. And where do you get all other...
696
Posted By birei
eq is for comparing strings. To check regular...
eq is for comparing strings. To check regular expression use =~ without double quotes:

if ($ARGV[0] =~ m/^-(\d+)$/) { print "I think it works\n"; }
696
Posted By birei
Hi D2K, Here an example of how you can check...
Hi D2K,

Here an example of how you can check the input argument:

$ echo "-4" | perl -nE 'm/^-(\d+)$/ and say $1 or die qq|Bad argument\n|'
4
$ echo "+-4" | perl -nE 'm/^-(\d+)$/ and say $1 or...
951
Posted By birei
Hi apenkov, Not an elaborated solution, but...
Hi apenkov,

Not an elaborated solution, but could work for this simple case. Try:

$ sed -n "/201209\(19\|20\|21\)/ p" infile
ABCDE_CMS.10.STOF.I_20120919_073742_P_6506.ict.zip...
2,702
Posted By birei
Hi mikezang, One way: $ awk ' FNR...
Hi mikezang,

One way:

$ awk '
FNR == NR && $0 ~ /^\/\*/ {
getline codeB;
comments[ $0 ] = codeB;
next;
}

$0 ~ /^\/\*/ {
if ( $0 in...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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