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. Shell Programming and Scripting
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
3. 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
4. Shell Programming and Scripting
hi
iam trying to extract a certain portion of the string whose value is stored below,but am getting syntax eror.The command is shown below
for file in GMG_BASEL2*.txt
do
m1= cat reporting_date.txt
year= expr substr $m1 1 2
echo $year
done
m1 has date 10/31/2009
but this vale... (6 Replies)
Discussion started by: jagadeeshn04
6 Replies
5. Shell Programming and Scripting
Hello all,
Please help me in letting me know the function of *substr* function in awk...
actually i am new with this function i can play with awk but for this function needs your help in making me understand the correct way of using it.
I am writting a code please advice regarding this... (4 Replies)
Discussion started by: jojo123
4 Replies
6. Shell Programming and Scripting
i want to get substring of second coloum of an file
using awk substring function.please help me out (2 Replies)
Discussion started by: RahulJoshi
2 Replies
7. 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
8. UNIX for Dummies Questions & Answers
Let's assume that I have a file with contents delimited by pipe:
"The mouse|ran up|the|clock"
"May|had a|little|lamb"
How would I use 'substr' to get the 3rd field. For example, "the" from the first line, and "little" from the second line?
# Loop over a file and read $LINE {
... (2 Replies)
Discussion started by: ChicagoBlues
2 Replies
9. 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
10. Shell Programming and Scripting
Hi,
I'm a newbie to UNIX scripting and I'm having some trouble compiling my script. I'm using the Bourne Shell and cannot seem to use the substr function correctly. I'm trying to extract the last two digits of a year that's stored in a variable based off of a condition. I've searched the... (4 Replies)
Discussion started by: E2004
4 Replies