For counting the occurences of specific character in the file
I am issuing the command
grep -o 'character' filename | wc -w
It works in other shells but not in HP-UX as there is no option -o for grep.
What do I do now? (9 Replies)
I'm trying to count the number of 2 specific characters in a very large file. I'd like to avoid using gsub because its taking too long.
I was thinking something like:
awk '-F' { t += NF - 1 } END {print t}' infile > outfile
which isn't working
Any ideas would be great. (3 Replies)
Hi,
I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this?
I tried to add it at 5th position using the below code. It didnt work. Please help!!!
awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done?
Example:
File:
A0199999123
A0199999124
A0199999125
Need to replace 99999 in positions 3-7 with 88888.
Any help is appreciated. (5 Replies)
Hi,
I need help regarding counting specific word or character per line and validate it against a specific number i.e 10. And if number of character equals the specific number then that line will be part of the output.
Specific number = 6
Specific word or char = ||
Sample data:... (1 Reply)
I'm looking for what I hope might be a one liner along these lines:
sed '/a line with more than 3 pipes in it/d'
I know how to get the pipe count in a string and store it in a variable, but I'm greedy enough to hope that it's possible via regex in the /.../d context. Am I asking too much? ... (5 Replies)
Hi, im still new in unix.
i want to ask how to delete character on specific position in line, lets say i want to remove 5 character from position 1000, so characters from position 1000-1005 will be deleted.
i found this sed command can delete 4 characters from position 10, but i dont know if... (7 Replies)
Discussion started by: bluesue
7 Replies
10. Post Here to Contact Site Administrators and Moderators
In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123.
So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies
LEARN ABOUT DEBIAN
ebook::tools::msreader
EBook::Tools::MSReader(3pm) User Contributed Perl Documentation EBook::Tools::MSReader(3pm)NAME
EBook::Tools::MSReader - Helper code for working with Microsoft Reader (.lit) e-books.
SYNOPSIS
use EBook::Tools::MSReader qw(find_convertlit find_convertlit_keys
system_convertlit);
$EBook::Tools::MSReader::convertlit_cmd = '/opt/convertlit/clit';
$EBook::Tools::MSReader::convertlit_keys = '/opt/convertlit/keys.txt';
my $convertlit = find_convertlit();
my $keyfile = find_convertlit_keys();
system_convertlit(infile => 'myfile.lit',
dir => 'myfile-unpacked');
PROCEDURES
All procedures are exportable, but none are exported by default.
"find_convertlit()"
Attempts to locate the convertlit executable by making a test execution on predicted locations (including just checking PATH) and looking
in the EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools.
Returns the system command used for a successful invocation, or undef if nothing worked.
This will use package variable $convertlit_cmd as its first guess, and set that variable to the return value as well.
"find_convertlit_keys($filename)"
Attempts to locate the convertlit "keys.txt" file by checking predicted filenames, both in the current working directory and in the
EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools.
If $filename is provided, the file "basename-keys.txt" will also be checked in both locations.
Returns the name of the first file found, or undef if nothing was found.
This will use package variable $convertlit_keys as its first guess, and set that variable to the return value as well.
"system_convertlit(%args)"
Runs "convertlit" to extract or downconvert a MS Reader .lit file. The procedures find_convertlit() and find_convertlit_keys() are both
called to locate necessary helper files.
Returns the return value from convertlit, or undef if convertlit or the input file could not be found, or neither output file nor directory
is specified.
Arguments
o "infile"
The input filename. If not specified or invalid, the procedure croaks.
o "outfile"
The output filename. If this is specified convertlit will perform a downconversion.
o "dir"
The output directory. If this is specified, and "outfile" is not, convertlit will perform an extraction. If both this and "outfile"
are specified, convertlit will downconvert and place the downconverted file into the specified directory.
o "keyfile"
The location of the "keys.txt" file containing the encryption keys, if available. This is only required if the ".lit" file is DRM-
protected and package variable $convertlit_keys does not point to the correct file.
BUGS AND LIMITATIONS
o All handling happens through ConvertLIT as an external helper. Native Perl code may eventually be written to handle non-DRMed
extraction.
o Unit tests are unwritten
AUTHOR
Zed Pobre <zed@debian.org>
LICENSE AND COPYRIGHT
Copyright 2008 Zed Pobre
Licensed to the public under the terms of the GNU GPL, version 2.
ConvertLIT (not included) is copyright 2002, 2003 Dan A. Jackson, and licensed under the terms of the GNU GPL, version 2 or later.
perl v5.10.1 2012-01-05 EBook::Tools::MSReader(3pm)