12-03-2009
hi.
well that was an example
it could be implemented this way
fstream file;
file.open("name_of_file",ios::in");
file.getline(email,100,' ');
file.getline(name,100,'\n');
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hello there
I need to find a string in an file, and then copy to a new file from the previous 6 lines to 41 lines after the string.
So, what i need to do , and just don't know how, is to find the string and copy 48 lines where the string would be in the 7th line.
I don't know if i can do it with... (10 Replies)
Discussion started by: vascobrito
10 Replies
2. Shell Programming and Scripting
I'm trying to get a script to copy a url then put it in a different place in the file.
Example is currently the script goes to a site takes the urls on it and then puts them into an html file. Only thing is I want to make them into links.
So currently lynx goes to the page takes out the urls.... (6 Replies)
Discussion started by: Paulw0t
6 Replies
3. Shell Programming and Scripting
Hi! just want to seek help on this:
i have a file wherein i want to find a string and copy the string after that and paste that other string to a new file.
ex:
TOTAL 123456
find "TOTAL" and copy "123456"
and paste "123456" to a new file
NOTE: there are many "TOTAL" strings on that... (12 Replies)
Discussion started by: kingpeejay
12 Replies
4. Shell Programming and Scripting
Hi
Does anybody know if there is a utility/command in ksh which would allow to copy/insert the contents of one string into certain positions of the other?
for example:
A=" ABCDEF "
B="HHH"
I need to insert contents of string "B" into string "A" from position 3 to 5, so... (3 Replies)
Discussion started by: aoussenko
3 Replies
5. Shell Programming and Scripting
Hi guys
I've got two columns, PRODUCT and BRAND, the Brand column currently has the first word of each product, I've acheived this by using SED to copy the first word of the PRODUCT column, however you run into trouble when the brand has more than one word, i.e. 'Weight Watchers'.
Is there... (22 Replies)
Discussion started by: mrpugster
22 Replies
6. Shell Programming and Scripting
i have a file1 with many lines. i have a script that will let me input a string. for example, APPLE. what i need to do is to copy all lines from file1 where i can find APPLE or any string that i specify and paste in on file 2
thanks in advance! (4 Replies)
Discussion started by: engr.jay
4 Replies
7. Shell Programming and Scripting
Hello,
My DATA:
PLOKIJ1234G 12 13 14 15
PLOKIJ1234E 12 13 14 15
PLOKIJ1234F 12 22 33 44
IJNUHB12346 55 66 77 88
IJNUHB12347 32 34 45 67
IJUHU345D 23 23 22 33
IJUHYG23E 11 24 23 23
IJUHYG23F 77 88 99 00
output:
PLOKIJ1234 PLOKIJ1234G 12 13 14 15
PLOKIJ1234... (11 Replies)
Discussion started by: asavaliya
11 Replies
8. Shell Programming and Scripting
Hi Folks,
Anybody has an idea how to split string based on separator _ (underscore) in Expect programming language?
e.g.if string is scmid1_scmid2 , i need to separate these two strings as scmid1 and scmid2.
Thanks in advance.
Sanket (1 Reply)
Discussion started by: Sanket
1 Replies
9. Shell Programming and Scripting
HI
Input A.txt
ABC907 ABC907_1B_9
ABC985 ABC985_1A_9
ABC985 ABC985_1B_9
ABC985 ABC985_1C_9
ABC05037 ABC05037_1A_9
ABC05037 ABC05037_1B_9
Base of column 2 last third char.
If It is A the 1,if B then 2 If C then 3
File B.txt
ABC907 ABC907_1B_9 2
ABC985 ABC985_1A_9 1
ABC985... (8 Replies)
Discussion started by: asavaliya
8 Replies
10. Shell Programming and Scripting
OS version: RHEL 6.7
Shell : Bash
I have a file like below. It has 500K lines.
I want to extract TAG_IDs shown in single quote at the end to copied to another file. As if I had copied the TAG_IDs using block select (Column Select) in modern text editor
$ cat file.txt
UPDATE TAGREF SET... (9 Replies)
Discussion started by: John K
9 Replies
LEARN ABOUT DEBIAN
io::handle::prototype::fallback
IO::Handle::Prototype::Fallback(3pm) User Contributed Perl Documentation IO::Handle::Prototype::Fallback(3pm)
NAME
IO::Handle::Prototype::Fallback - Create IO::Handle like objects using a set of callbacks.
SYNOPSIS
my $fh = IO::Handle::Prototype::Fallback->new(
getline => sub {
my $fh = shift;
...
},
);
DESCRIPTION
This class provides a way to define a filehandle based on callbacks.
Fallback implementations are provided to the extent possible based on the provided callbacks, for both writing and reading.
SPECIAL CALLBACKS
This class provides two additional methods on top of IO::Handle, designed to let you implement things with a minimal amount of baggage.
The fallback methods are all best implemented using these, though these can be implemented in terms of Perl's standard methods too.
However, to provide the most consistent semantics, it's better to do this:
IO::Handle::Prototype::Fallback->new(
__read => sub {
shift @array;
},
);
Than this:
IO::Handle::Prototype::Fallback->new(
getline => sub {
shift @array;
},
);
Because the fallback implementation of "getline" implements all of the extra crap you'd need to handle to have a fully featured
implementation.
__read
Return a chunk of data of any size (could use $/ or not, it depends on you, unlike "getline" which probably should respect the value of
$/).
This avoids the annoying "substr" stuff you need to do with "read".
__write $string
Write out a string.
This is like a simplified "print", which can disregard $, and "$" as well as multiple argument forms, and does not have the extra
"substr" annoyance of "write" or "syswrite".
WRAPPING
If you provide a single reading related callback ("__read", "getline" or "read") then your callback will be used to implement all of the
other reading primitives using a string buffer.
These implementations handle $/ in all forms ("undef", ref to number and string), all the funny calling conventions for "read", etc.
FALLBACKS
Any callback that can be defined purely in terms of other callbacks in a way will be added. For instance "getc" can be implemented in terms
of "read", "say" can be implemented in terms of "print", "print" can be implemented in terms of "write", "write" can be implemented in
terms of "print", etc.
None of these require special wrapping and will always be added if their dependencies are present.
GLOB OVERLOADING
When overloaded as a glob a tied handle will be returned. This allows you to use the handle in Perl's IO builtins. For instance:
my $line = <$fh>
will not call the "getline" method natively, but the tied interface arranges for that to happen.
perl v5.10.1 2009-09-29 IO::Handle::Prototype::Fallback(3pm)