Sponsored Content
Top Forums Shell Programming and Scripting Can't input large file to variable Post 303019239 by RudiC on Monday 25th of June 2018 03:59:19 PM
Old 06-25-2018
Now, that I'd call ambitious: Define a 5GB variable!

Not sure you exceeded any system / configuration parameter, though. Looks more like you hit a limit of the virtual memory system / manager.

What be the reason to read an entire file into a variable in the first place?
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get variable input from a file

Hi guys, I want to input some variables from a file. I tried it with following script, for i in 1 2 3 4 do read varible1 varible2 < ddd.txt echo $varible1 $varible2 done ... (1 Reply)
Discussion started by: maheshsri
1 Replies

2. UNIX and Linux Applications

Input a variable and write to a file using awk

Hi I am trying to edit a csv file. Bacically I need to input a search variable and the value that must be changed in one of the fields corresponding to that searched variable. My csv file looks like so: 1,1A,5 1,1B,2 1,1C,3 2,2A,7 2,2B,4 2,2C,0 3,3A,1 3,3B,6 3,3C,4 I want to... (4 Replies)
Discussion started by: ladyAnne
4 Replies

3. Shell Programming and Scripting

KSH: Compare variable to $1 in an input file

Hello, I am working with KSH on AIX and I have 2 files generated from different sources... as seen below: FILE1 FILE2 AAA AAA@ABS0001C BBB BBB@ABS0003D CCC CCC@ABS0023A DDD DDD@ABC0145D EEE EEE@ABS0090A FFF FFF@ABS0002A GGG GGG@ABC0150D HHH FILE1 is main main data source,... (4 Replies)
Discussion started by: right_coaster
4 Replies

4. Shell Programming and Scripting

Find and analyze variable Strings in a large file.

Hi guys, I have multiple files (>5000) which I have in a folder. I read every file name and put it in a tmp variable "i" so that i can use it in the following task. I have a large .txt file (>50 MB) in which I want to find the variable "i" and the lines after this variable, so that I can use... (4 Replies)
Discussion started by: Ashitaka007
4 Replies

5. Shell Programming and Scripting

Reading from a File and Using as an Input variable

I need to know how the the string constant from Input File should be read and provide as input data for the script . INPUT FILE CONST VARIABLE myname=/root/dir/syslog/myname1 myname=/root/dir/syslog/myname2 myname=/root/dir/syslog/myname3 urname=/root/dir/syslog/urname1... (6 Replies)
Discussion started by: baraghun
6 Replies

6. Shell Programming and Scripting

awk built-in variable for input file

Hi guys, Does awk have a built-in variable which I can use to display the input file it's currently reading? I'm currently concatenating multiple files using awk and later on do some parsing. But for now, I want to add an extra column in the main output data file - basically putting in the... (3 Replies)
Discussion started by: Det7
3 Replies

7. Shell Programming and Scripting

Need to delete large set of files (i.e) close to 100K from a directory based on the input file

Hi all, I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file. I have already prepared a list of files in the input file. Kndly help me. Thanks, Prash (36 Replies)
Discussion started by: prash358
36 Replies

8. Shell Programming and Scripting

awk input large file

Hi...Does anyone know how to input huge file about 25 GB to awk if single file then this works awk '{print}' <hugefile suppose if have to use something like this awk FNR==NR{x=$0;next}{print $0,x}' hugefile1 hugefile2 then how to redirect ? and is there any provision to assign memory... (12 Replies)
Discussion started by: Akshay Hegde
12 Replies

9. Shell Programming and Scripting

XML variable for input in same input file

Dear All , i stuck in one problem executing xml .. i have input xml as <COMMAND name="ARRANGEMENT.WRITE" timestamp="0" so="initial"> <SVLOBJECT> <LONG name="CSP_PMNT_ID" val="-1"/> <MONEY name="CSP_CEILING" amount="0.0" currency="AUD"/> ... (6 Replies)
Discussion started by: arvindng
6 Replies

10. Shell Programming and Scripting

Checking the file depending on the input variable

Hi I have a requirement of taking time as input variable outside the script.depending on the time it will check the file output .like ./script.sh <30 min> so script.sh should run every 5 minutes ie.6 times to check the output file.Can any one please help here. (7 Replies)
Discussion started by: netdbaind
7 Replies
MLOCK(2)						      BSD System Calls Manual							  MLOCK(2)

NAME
mlock, munlock -- lock (unlock) physical pages in memory SYNOPSIS
#include <sys/mman.h> int mlock(const void *addr, size_t len); int munlock(const void *addr, size_t len); DESCRIPTION
The mlock system call locks a set of physical pages into memory. The pages are associated with a virtual address range that starts at addr and extends for len bytes. The munlock call unlocks pages that were previously locked by one or more mlock calls. For both calls, the addr parameter should be aligned to a multiple of the page size. If the len parameter is not a multiple of the page size, it will be rounded up to be so. The entire range must be allocated. After an mlock call, the indicated pages will cause neither a non-resident page nor address-translation fault until they are unlocked. They may still cause protection-violation faults or TLB-miss faults on architectures with software-managed TLBs. The physical pages remain in memory until all locked mappings for the pages are removed. Multiple processes may have the same physical pages locked via their own virtual address mappings. Similarly, a single process may have pages multiply-locked via different virtual mappings of the same pages or via nested mlock calls on the same address range. Unlocking is performed explicitly by munlock or implicitly by a call to munmap, which deallocates the unmapped address range. Locked mappings are not inherited by the child process after a fork(2). Because physical memory is a potentially scarce resource, processes are limited in how much memory they can lock down. A single process can mlock the minimum of a system-wide ``wired pages'' limit and the per-process RLIMIT_MEMLOCK resource limit. RETURN VALUES
A return value of 0 indicates that the call succeeded and all pages in the range have either been locked or unlocked, as requested. A return value of -1 indicates an error occurred and the locked status of all pages in the range remains unchanged. In this case, the global location errno is set to indicate the error. ERRORS
mlock() and munlock() will fail if: [EINVAL] The address given is not page-aligned or the length is negative. [ENOMEM] Part or all of the specified address range is not mapped to the process. mlock() will fail if: [EAGAIN] Locking the indicated range would exceed either the system or per-process limit for locked memory. [ENOMEM] Some portion of the indicated address range is not allocated. There was an error faulting/mapping a page. munlock() will fail if: [ENOMEM] Some portion of the indicated address range is not allocated. Some portion of the indicated address range is not locked. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/mman.h> The include file <sys/types.h> is necessary. int mlock(caddr_t addr, size_t len); int munlock(caddr_t addr, size_t len); The variable type of addr has changed. SEE ALSO
fork(2), mincore(2), minherit(2), mmap(2), munmap(2), setrlimit(2), getpagesize(3), compat(5) BUGS
Unlike The Sun implementation, multiple mlock calls on the same address range require the corresponding number of munlock calls to actually unlock the pages, i.e. mlock nests. This should be considered a consequence of the implementation and not a feature. The per-process resource limit is a limit on the amount of virtual memory locked, while the system-wide limit is for the number of locked physical pages. Hence a process with two distinct locked mappings of the same physical page counts as 2 pages against the per-process limit and as only a single page in the system limit. HISTORY
The mlock() and munlock() functions first appeared in 4.4BSD. BSD
June 2, 1993 BSD
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy