Sponsored Content
Top Forums Shell Programming and Scripting Can't input large file to variable Post 303019237 by newbie2010 on Monday 25th of June 2018 03:28:46 PM
Old 06-25-2018
Can't input large file to variable

I have a file that I'm trying to place into a variable.
I've tried the following:

Code:
DATE=`date +%Y%m%d`
filez=$(cat /tmp/Test_$DATE.txt)

Code:
DATE=`date +%Y%m%d`
filez=$(</tmp/Test_$DATE.txt)

Code:
DATE=`date +%Y%m%d`
filez=$(`cat /tmp/Test_$DATE.txt`)

None of these lines allows the file to go into the variable, unless the file is small. If it is a small file, then it works. If it is a large file, I get the following error:

Code:
builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)
./scripttest.bash: xmalloc: /builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)
./scripttest.bash: xmalloc: /builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)

Anyone know how to fix this? Apparently the file size causes it.
 

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
DBIx::Class::Storage::DBI::Informix(3)			User Contributed Perl Documentation		    DBIx::Class::Storage::DBI::Informix(3)

NAME
DBIx::Class::Storage::DBI::Informix - Base Storage Class for Informix Support DESCRIPTION
This class implements storage-specific support for the Informix RDBMS METHODS
connect_call_datetime_setup Used as: on_connect_call => 'datetime_setup' In connect_info to set the "DATE" and "DATETIME" formats. Sets the following environment variables: GL_DATE="%m/%d/%Y" GL_DATETIME="%Y-%m-%d %H:%M:%S%F5" The "DBDATE" and "DBCENTURY" environment variables are cleared. NOTE: setting the "GL_DATE" environment variable seems to have no effect after the process has started, so the default format is used. The "GL_DATETIME" setting does take effect however. The "DATETIME" data type supports up to 5 digits after the decimal point for second precision, depending on how you have declared your column. The full possible precision is used. The column declaration for a "DATETIME" with maximum precision is: column_name DATETIME YEAR TO FRACTION(5) The "DATE" data type stores the date portion only, and it MUST be declared with: data_type => 'date' in your Result class. You will need the DateTime::Format::Strptime module for inflation to work. AUTHOR
See "AUTHOR" in DBIx::Class and "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.16.2 2012-08-16 DBIx::Class::Storage::DBI::Informix(3)
All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy