Sponsored Content
Top Forums UNIX for Dummies Questions & Answers assingn a variable a filename and then reading it in Post 302337122 by magnia on Thursday 23rd of July 2009 12:29:14 PM
Old 07-23-2009
assingn a variable a filename and then reading it in

Im trying to set a filename to a variable and then read the file in using the variable but im getting a syntax error. any ideas?

#!/bin/bash



function scanFile()
{
while read $1
do
echo $filename
done
}

file1=report.log


scanFile() $file1
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a file using sh with spaces in filename

Hi I am trouble parsing through a file with spaces in the filename. I need to grab "supportIDPS/SCM/windows_install/file groups/dds.fgl" and then do a md5sum on it. I am using sh. Any help is appreciated. Here is an example of the input file: 7eedbc9f7902bf4c1878d9e571addf9a ... (4 Replies)
Discussion started by: jekl5
4 Replies

2. Shell Programming and Scripting

mv Filename variable to another filename

Anyone who can assist : I am trying to pass the group vairiable to a filename: rpt_tsavegrp=/export/legato/scripts/$group_savegrp_rpt.$dat It will not pass to variable. Anyone have any ideas what I am doing wrong here. Thanks # This script sends email that save group completed.... (3 Replies)
Discussion started by: gzs553
3 Replies

3. UNIX for Dummies Questions & Answers

get the latest file by reading the date in the filename.

Hi, I grep for a pattern in a list of files. "grep -i -l $pattern *.datx*" it may give me n number of files. say for eg, it gives me 2 files. lock_eicu_20071228_00000000.dat_20071228_05343100 lock_eicu_20080501_00000000.dat_20080501_05343900 out of these 2 files I need to get the... (7 Replies)
Discussion started by: prsshini
7 Replies

4. Shell Programming and Scripting

variable used as filename

Hello, i'm fairly new to scripting, so please bear with me (I did try looking this up first, i figured it had to have been asked already). #!/bin/bash fileName=`date | sed -n 's/ /_/g p' | sed -n 's/^/Backup_/p' | sed -n 's/$/\.tar/p'`; #THIS SETS BACKUP_DATE echo $fileName #TEST OF VALUE ... (4 Replies)
Discussion started by: jzacsh
4 Replies

5. Shell Programming and Scripting

Reading variable from file variable values

Hi, Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks Queue Dev Status Job Files User PP % Blks Cp Rnk ------- ----- ---------... (5 Replies)
Discussion started by: sagii
5 Replies

6. UNIX for Dummies Questions & Answers

Reading filename from directory

I am using the following code to read filename from the directory: for i in ` ls $inputDir | grep $partialName*.csv` do echo $i done But the echo is giving me the following: ls | grep cm_ctx*.csv instead of the full filename "cm_ctx_2009_07_15_17_18.csv" Any ideas anyone? I... (2 Replies)
Discussion started by: khanvader
2 Replies

7. Homework & Coursework Questions

Matlab help! Reading in a file with a variable filename

1. The problem statement, all variables and given/known data: I want to read in a file, and plot the data in matlab. However, I do not like hardwiring filenames into my codes, so I always give the user the option to specify what the filename is. I am pretty inexperienced with matlab, so I have no... (0 Replies)
Discussion started by: ds7202
0 Replies

8. Shell Programming and Scripting

Need help in reading a filename

Hi Guys, I have the following input. test_junk_file__20120210092009.txt latest_file__20120210092009.txt side_load_junk_file__20120210092009.txt I need to exclude the timestamp part from the file. so, the output should be as follows. test_junk_file.txt latest_file.txt... (7 Replies)
Discussion started by: mac4rfree
7 Replies

9. Shell Programming and Scripting

reading filename in nested directories

Hi all, I have some directory structure as $ls -ltr drwxr-xr-x 1 mscprod us_msc 512 May 10 08:34 650 drwxr-xr-x 1 mscprod us_msc 512 May 10 08:51 652 drwxr-xr-x 1 mscprod us_msc 512 May 10 08:51 640 drwxr-xr-x 1 mscprod us_msc512 May 10 09:13 654 $ cd 650/ $ls fileabc.root and within... (7 Replies)
Discussion started by: emily
7 Replies

10. Open Source

Splitting files using awk and reading filename value from input data

I have a process that requires me to read data from huge log files and find the most recent entry on a per-user basis. The number of users may fluctuate wildly month to month, so I can't code for it with names or a set number of variables to capture the data, and the files are large so I don't... (7 Replies)
Discussion started by: rbatte1
7 Replies
Gtk2::Rc(3)						User Contributed Perl Documentation					       Gtk2::Rc(3)

NAME
Gtk2::Rc METHODS
Gtk2::Rc->add_default_file ($filename) o $filename (localized file name) list = Gtk2::Rc->get_default_files Returns the list of files that GTK+ will read at the end of Gtk2->init. Gtk2::Rc->set_default_files (file1, ...) o ... (list) of strings, the rc files to be parsed o $file1 (localized file name) Sets the list of files that GTK+ will read at the end of Gtk2->init. string = Gtk2::Rc->get_im_module_file string = Gtk2::Rc->get_im_module_path string = Gtk2::Rc->get_module_dir Gtk2::Rc->parse ($filename) o $filename (localized file name) Gtk2::Rc->parse_string ($rc_string) o $rc_string (string) boolean = Gtk2::Rc->reparse_all boolean = Gtk2::Rc->reparse_all_for_settings ($settings, $force_load) o $settings (Gtk2::Settings) o $force_load (boolean) Gtk2::Rc->reset_styles ($settings) o $settings (Gtk2::Settings) Since: gtk+ 2.4 style = Gtk2::Rc->get_style_by_paths ($settings, $widget_path, $class_path, $package) o $settings (Gtk2::Settings) o $widget_path (string) o $class_path (string) o $package (string) style = Gtk2::Rc->get_style ($widget) o $widget (Gtk2::Widget) string = Gtk2::Rc->get_theme_dir SEE ALSO
Gtk2 COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.12.1 2010-07-05 Gtk2::Rc(3)
All times are GMT -4. The time now is 11:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy