03-31-2018
Quote:
Originally Posted by
Scrutinizer
An array is used to count the occurrence in the spend file and in a way "post processed" while reading the transfile...
You are right, but another warning is in order: because the processing is done in memory the script has - depending on the sizes of the files involved - the potential to exhaust the systems memory if the files are very big and/or the RAM is small.
I hope this helps.
bakunin
10 More Discussions You Might Find Interesting
1. Linux
I need to find the line count of multiple strings in a particular file. The strings are as follows:
bmgcc
bmgccftp
bsmsftp
bulkftp
cctuneftp
crbtftp
crmpos
cso
gujhr
I am doing manual grep for each of the string to find the line count. The command i am using right now is:
grep mark... (3 Replies)
Discussion started by: salaathi
3 Replies
2. Shell Programming and Scripting
Hello,
I'm looking for a wait to count the number of occurrences of a certain string of characters within a file. The file that I trying to parce has segments within the file that have a header and footer to each segment and I'm trying to do a count of the header string and compare it to a count... (9 Replies)
Discussion started by: bd_joy
9 Replies
3. Shell Programming and Scripting
Hi All,
I have a below file:
==================
02:53 pravin-root
02:53 pravin-root
03:05 pravin-root
02:55 pravin1-root
02:59 pravin1-root
==================
How do I find the first and last value of column 1. For example, how do I find 02:53 is the first time stamp and 03:05 is... (3 Replies)
Discussion started by: praving5
3 Replies
4. Shell Programming and Scripting
I am writing a package manager in BASH and I would like a small snippet of code that finds lines that match exact input and count them. For example, my file contains:
xyz
xyz-lib2.0+
xyz-lib2.0
xyz-lib1.5
and "grep -c xyz" returns 4.
The current function is:
# $1 is the package name.... (3 Replies)
Discussion started by: cooprocks123e
3 Replies
5. Shell Programming and Scripting
I have a file containing about 5 million rows, in the file there are some records which has extra delimiter at random position. (we dont know the positions), now we have to Count the delimeter from each row and if the count of delimeter is not matching then I want to delete those rows from the... (5 Replies)
Discussion started by: Akumar1
5 Replies
6. Shell Programming and Scripting
Hi Guys,
The script which I am using works really good for finding the file count for files that are not symlink. I know I can use find command like:
find . -type l | wc -l
This way I can get filecount of the symlink but is there a one liner to use -type l and -type f option ? That is... (4 Replies)
Discussion started by: dixits
4 Replies
7. Shell Programming and Scripting
Hi
I ahve a lookup file wiht seven words
CD
HT
CAD
HT
T1D
T2D
BDanother file contain data like this
CHRM1 P11229 Pirenzepine DAP000492 Peptic ulcer disease Approved T2D
CHRM1 P11229 Glycopyrrolate DAP001116 Anesthetic Approved T2D
CHRM1 P11229 ... (7 Replies)
Discussion started by: manigrover
7 Replies
8. UNIX for Dummies Questions & Answers
How to find count total number of pattern in a file …
File contains : a.txt
-------------
aaa bbb nnn
ccc aaa bbb
aaa ddd aaa
aaa aaa aaa
grep -c aaa a.txt
Op: 4 ( But my requirement is should count the total no of patterns as 7 ) (4 Replies)
Discussion started by: Jitten
4 Replies
9. UNIX for Beginners Questions & Answers
I'm trying to use awk to count the occurrences of two matching fields of a CSV file.
For instance, for data that looks like this...
Joe,Blue,Yes,No,High
Mike,Blue,Yes,Yes,Low
Joe,Red,No,No,Low
Joe,Red,Yes,Yes,Low
I've been trying to use code like this...
countvar=`awk ' $2~/$color/... (4 Replies)
Discussion started by: nmoore2843
4 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output
Here is how my file looks like
1.1.1.1
1.1.1.2
1.1.1.3
1.1.2.1
1.1.2.2
1.1.3.1
1.1.3.2
1.1.3.3
1.1.3.4
So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
LEARN ABOUT REDHAT
mlockall
MLOCKALL(2) Linux Programmer's Manual MLOCKALL(2)
NAME
mlockall - disable paging for calling process
SYNOPSIS
#include <sys/mman.h>
int mlockall(int flags);
DESCRIPTION
mlockall disables paging for all pages mapped into the address space of the calling process. This includes the pages of the code, data and
stack segment, as well as shared libraries, user space kernel data, shared memory and memory mapped files. All mapped pages are guaranteed
to be resident in RAM when the mlockall system call returns successfully and they are guaranteed to stay in RAM until the pages are
unlocked again by munlock or munlockall or until the process terminates or starts another program with exec. Child processes do not
inherit page locks across a fork.
Memory locking has two main applications: real-time algorithms and high-security data processing. Real-time applications require determin-
istic timing, and, like scheduling, paging is one major cause of unexpected program execution delays. Real-time applications will usually
also switch to a real-time scheduler with sched_setscheduler. Cryptographic security software often handles critical bytes like passwords
or secret keys as data structures. As a result of paging, these secrets could be transfered onto a persistent swap store medium, where they
might be accessible to the enemy long after the security software has erased the secrets in RAM and terminated. For security applications,
only small parts of memory have to be locked, for which mlock is available.
The flags parameter can be constructed from the bitwise OR of the following constants:
MCL_CURRENT Lock all pages which are currently mapped into the address space of the process.
MCL_FUTURE Lock all pages which will become mapped into the address space of the process in the future. These could be for instance new
pages required by a growing heap and stack as well as new memory mapped files or shared memory regions.
If MCL_FUTURE has been specified and the number of locked pages exceeds the upper limit of allowed locked pages, then the system call which
caused the new mapping will fail with ENOMEM. If these new pages have been mapped by the the growing stack, then the kernel will deny
stack expansion and send a SIGSEGV.
Real-time processes should reserve enough locked stack pages before entering the time-critical section, so that no page fault can be caused
by function calls. This can be achieved by calling a function which has a sufficiently large automatic variable and which writes to the
memory occupied by this large array in order to touch these stack pages. This way, enough pages will be mapped for the stack and can be
locked into RAM. The dummy writes ensure that not even copy-on-write page faults can occur in the critical section.
Memory locks do not stack, i.e., pages which have been locked several times by calls to mlockall or mlock will be unlocked by a single call
to munlockall. Pages which are mapped to several locations or by several processes stay locked into RAM as long as they are locked at
least at one location or by at least one process.
On POSIX systems on which mlockall and munlockall are available, _POSIX_MEMLOCK is defined in <unistd.h>.
RETURN VALUE
On success, mlockall returns zero. On error, -1 is returned, errno is set appropriately.
ERRORS
ENOMEM The process tried to exceed the maximum number of allowed locked pages.
EPERM The calling process does not have appropriate privileges. Only root processes are allowed to lock pages.
EINVAL Unknown flags were specified.
CONFORMING TO
POSIX.1b, SVr4. SVr4 documents an additional EAGAIN error code.
SEE ALSO
munlockall(2), mlock(2), munlock(2)
Linux 1.3.43 1995-11-26 MLOCKALL(2)