Your example is not very clear. You mean, extract and print those tokens which contain the string "abc"?
Do you want to preserve newlines? (This solution does.) What about spaces between the tokens? (This solution normalizes them to one space between each.)
Last edited by era; 03-18-2008 at 12:26 PM..
Reason: Show which lines are input
Hi,
I want to be able to list all the names in a file which begin with a capital letter, but I don't want it to list words that begin a new sentence. Is there any way round this?
Thanks for your help. (1 Reply)
Hello All,
I am new to UNIX, how do i get the First letter of each Word from a line in shell scripting.
For Example
line = "The Jack In The Box"
I want to reterive The letters T for The, J from Jack, I from In, T from The and B from Box.
and store in another string.
Can anyone... (5 Replies)
hi,
if i have a string of letters and seperatly i have a single letter. how do i check whether that specific letter is in my string aswell? any ideas? (2 Replies)
Hi All,
I am new to UNIX and i am trying to write a script.My requirement is that from the following logs i need to get the following outputs:
abc_lifecycle.log
bcde_enjoy.log
abc_twinkle.log
Output expecting:
lifecycle
enjoy
twinkle
Could you please help me in getting this? (9 Replies)
Total Bash noob, have been successful in doing my script by searching and looking at examples, but I need some assitance with this one, just can't figure it out.
In the Bash script I am trying to capitalize the first letter of every word in a string, ideally not changing other capitalization.
... (5 Replies)
Hello,
I need a script to do the following:
I have a file filled of lines like:
valu -> value
confirmaton -> confirmation
I need a script to compare the first and last letters of the words, for example for the line:
valu -> value
compare "v" to "v" and "u" to "e" and print the line... (7 Replies)
I need to use bash to convert sentences where all words start with a small letter into one where all words start with a capital letter.
So that a string like:
are utilities ready for hurricane sandy
becomes:
Are Utilities Ready For Hurricane Sandy (10 Replies)
I have a word file that looks like:
pens
binder
spiral
user
I want to delete all the words without the letter /s/, so output looks like:
pens
spiral
user
I tried using sed:
sed '//d' infile.txt > out.txt (5 Replies)
Hi,
I have written the following python snippet to store the capital letter starting words into a dictionary as key and no of its appearances as a value in this dictionary against the key.
#!/usr/bin/env python
import sys
import re
hash = {} # initialize an empty dictinonary
for line in... (1 Reply)
Hi,
I have this text file with these words and I need help with removing words with repeated letter from these lines.
1 ama
5 bib
29 bob
2 bub
5 civic
2 dad
10 deed
1 denned
335 did
1 eeee
1 eeeee
2 eke
8... (4 Replies)
Discussion started by: crepe6
4 Replies
LEARN ABOUT MOJAVE
moose::autobox::array5.18
Moose::Autobox::Array(3) User Contributed Perl Documentation Moose::Autobox::Array(3)NAME
Moose::Autobox::Array - the Array role
SYNOPOSIS
use Moose::Autobox;
[ 1..5 ]->isa('ARRAY'); # true
[ a..z ]->does('Moose::Autobox::Array'); # true
[ 0..2 ]->does('Moose::Autobox::List'); # true
print "Squares: " . [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
print [ 1, 'number' ]->sprintf('%d is the loneliest %s');
print ([ 1 .. 5 ]->any == 3) ? 'true' : 'false'; # prints 'true'
DESCRIPTION
This is a role to describe operations on the Array type.
METHODS
pop
push ($value)
shift
unshift ($value)
delete ($index)
sprintf ($format_string)
slice (@indices)
flatten
flatten_deep ($depth)
first
last
Indexed implementation
at ($index)
put ($index, $value)
exists ($index)
keys
values
kv
each
each_key
each_value
each_n_values ($n, $callback)
List implementation
head
tail
join (?$seperator)
length
map (&block)
grep (&block)
Note that, in both the above, $_ is in scope within the code block, as well as being passed as $_[0]. As per CORE::map and CORE::grep,
$_ is an alias to the list value, so can be used to modify the list, viz:
use Moose::Autobox;
my $foo = [1, 2, 3];
$foo->map( sub {$_++} );
print $foo->dump;
yields
$VAR1 = [
2,
3,
4
];
reverse
sort (?&block)
Junctions
all
any
none
one
meta
print
say
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2006-2008 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.18.2 2013-10-27 Moose::Autobox::Array(3)