10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a large string containing about 17,500 characters and I would like to obtain the value for token. token only appears in the entire string once and is towards the end of the string at the 17,200 area but that could change. Using perl can someone assist me with obtaining the value which in... (10 Replies)
Discussion started by: azdps
10 Replies
2. UNIX for Dummies Questions & Answers
awk '/^>/{id=$0;next}length>=7 { print id, "\n"$0}' Test.txt
Can I use substr to achieve the same task?
Thanks! (8 Replies)
Discussion started by: Xterra
8 Replies
3. Shell Programming and Scripting
I have a command like this:
listdb ID923 -l |gawk '{if (substr($0,37,1)==1 && NR == 3)print "YES" else if (substr ($0,37,1)==0 && NR == 3) print "NO"}'
This syntax doesn't work. But I was able to get this to work:
listdb ID923 -l |gawk '{if (substr($0,37,1)==1 && NR == 3)print "YES"}'
... (4 Replies)
Discussion started by: newbie2010
4 Replies
4. Shell Programming and Scripting
Hi Everyone,
# cat a.txt
a;b;c;64O
a;b;c;d;ee;f
# cat a.pl
#!/usr/bin/perl
use strict;
use warnings;
my $tmp3 = ",,a,,b,,c,,d,,e,,f,,";
open(my $FA, "a.txt") or die "$!";
while(<$FA>) {
chomp;
my @tmp=split(/\;/, $_);
if ( ($tmp =~ m/^(64O)/i) || ($tmp... (3 Replies)
Discussion started by: jimmy_y
3 Replies
5. Shell Programming and Scripting
Hi Everyone,
$tmp="20090620231013";
$tmp = substr($tmp,0,8)." ".substr($tmp,8,2).":".substr($tmp,10,2).":".substr($tmp,12,2);
So my output is:
20090620 23:10:13.
I only can think substr is easy, any perl can do this just one line very simple efficient one? :eek:
Thanks (3 Replies)
Discussion started by: jimmy_y
3 Replies
6. UNIX for Dummies Questions & Answers
Hi friends,
I have written a perl code and it works fine but I am not sure tommorow it works or not, please help me.
problem : When diff is 1 then success other than its failure but tomorrow its 20090401 and the enddate is 20090331. thats why I write the code this type but it does not work and... (1 Reply)
Discussion started by: tukuna82
1 Replies
7. Shell Programming and Scripting
Any clue to write something to a particular location in Perl?
Suppose
$line = ‘abc cde 1234”
How to write ( example string "test") on location 4 without parsing the whole line.
Output should be $line = ‘abctest 1234”
this is not search and replace. just to add substring into... (3 Replies)
Discussion started by: jaivipin
3 Replies
8. Shell Programming and Scripting
Hi,
I have a long string like,
aabab|bcbcbcbbc|defgh|paswd123 dedededede|efef|ghijklmn|paswd234 ghghghghgh|ijijii|klllkkk|paswd345 lmlmlmmm|nononononn|opopopopp|paswd456
This string is devided into one space between substrings. This substrings are,
aabab|bcbcbcbbc|defgh|paswd123... (6 Replies)
Discussion started by: syamkp
6 Replies
9. UNIX for Dummies Questions & Answers
Hi,
My input file is
41;2;xxxx;yyyyy....
41;2;xxxx;yyyyy....
41;2;xxxx;yyyyy....
..
..
I need to change the second field value from 2 to 1. i.e.,
41;1;xxxx;yyyyy....
41;1;xxxx;yyyyy....
41;1;xxxx;yyyyy....
..
..
Thanks in advance. (9 Replies)
Discussion started by: deepakwins
9 Replies
10. Shell Programming and Scripting
What is the more efficient way to do this (awk only and default FS) ?
$ echo "jefe@alm"|awk '{pos = index($0, "@");printf ("USER: %s\n",substr ($0,1,pos-1))}'
USER: jefe
Thx in advance (2 Replies)
Discussion started by: Klashxx
2 Replies