Sponsored Content
Top Forums Shell Programming and Scripting How to search a filename stored in a variable using a pattern? Post 302836357 by Little on Wednesday 24th of July 2013 03:58:31 AM
Old 07-24-2013
thanks for the code.

but in the above code, the array FILE[] is not accessible outside the while loop.
when i try to print FILE[0] and FILE[1] outside the while loop, it shows empty values.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK: pattern not properly stored in variable?

Hey there, I have a table of contents file of the form 1 Title1 1.1 Subtitle1 1.1.1 Subsubtitle1 1.1.2 Subsubtitle2 ... and want to count the number of dots in the first field to find out the level of the section. I use the gsub function for the job, which works if I pass the pattern... (2 Replies)
Discussion started by: herrsimon
2 Replies

2. Shell Programming and Scripting

Search for awk pattern in unix env variable

For a Script I need to detemine which field of the unix environment variable SHLIB_PATH has the WALTDB entry. export SHLIB_PATH=/usr/user5/WALTDB/oracle/product/10.2.0/lib32:/usr/TZD/bin.wdad/mug/oracle/lib: echo $SHLIB_PATH | awk -F: '{ print $1 }' Shure gives me the first entry, but... (6 Replies)
Discussion started by: sdohn
6 Replies

3. Shell Programming and Scripting

How to assign the Pattern Search string as Input Variable

guys, I need to know how to assing pattern matched string as an input command variable. Here it goes' My script is something like this. ./routing.sh <Server> <enable|disable> ## This Script takes an input <Server> variable from this line of the script ## echo $1 | egrep... (1 Reply)
Discussion started by: raghunsi
1 Replies

4. Shell Programming and Scripting

search the pattern in a file and replace with variable already defined previously in csh

I want to replace a certain pattern with the variable already defined. e.g. set path_verilog = /home/priya/bin/verilogfile my file contents are : verilog new verilog is defined here verilog_path_comes I am using the below command sed 's/verilog_path_comes/'$path_verilog'/g' <filename>... (2 Replies)
Discussion started by: nehashine
2 Replies

5. Shell Programming and Scripting

PERL : pattern matching a string stored in a variable

I have two variables, my $filename = "abc_yyyy_mm_dd.txt"; my $filename1 = " abc_2011_11_07.txt"; I need to perform some operations after checking if $filename has $filename1 in it i have used the below code, if($filename =~ /^$filename1/) { ---- -- } (2 Replies)
Discussion started by: irudayaraj
2 Replies

6. Shell Programming and Scripting

[Solved] Replace extension of filename stored in a variable

Hi there, I have a small question (most like a true beginners question :) ). In a script I have a filename stored in variable (vFile). Through the an input parameter this variable gets its value (for instance cookie.txt). Two new variables are created with the value of vFile, but with a... (2 Replies)
Discussion started by: rberkers
2 Replies

7. UNIX for Dummies Questions & Answers

Assigning matched pattern within filename to variable

I am writing a bash script where I use two types of files that both contain a numerical pattern of the type 123.4567 (always groups of three and four digits separated by period) within their filenames. I need to assign the numerical patterns of these filenames to variables (inside a for loop),... (6 Replies)
Discussion started by: Mauve
6 Replies

8. Shell Programming and Scripting

Search if file exists for a file pattern stored in array

Hi experts, I have two arrays one has the file paths to be searched in , and the other has the files to be serached.For eg searchfile.dat will have abc303 xyz123 i have to search for files that could be abc303*.dat or for that matter any extension . abc303*.dat.gz The following code... (2 Replies)
Discussion started by: 100bees
2 Replies

9. Shell Programming and Scripting

awk variable search and line count between variable-search pattern

Input: |Running the Rsync|Sun Oct 16 22:48:01 BST 2016 |End of the Rsync|Sun Oct 16 22:49:54 BST 2016 |Running the Rsync|Sun Oct 16 22:54:01 BST 2016 |End of the Rsync|Sun Oct 16 22:55:45 BST 2016 |Running the Rsync|Sun Oct 16 23:00:02 BST 2016 |End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
Discussion started by: busyboy
4 Replies

10. Shell Programming and Scripting

awk -Search pattern through Variable

Hello, We have wrote shell script for multiple file name search pattern. file format: <numner>_<20180809>.txt starting with single number and ending with 8 digits number Command: awk -v string="12_1234" -v serch="^+_+$" "BEGIN{ if (string ~/serch$/) print string }" If sting matches... (4 Replies)
Discussion started by: koti_rama
4 Replies
update-grub(8)						      System Manager's Manual						    update-grub(8)

NAME
update-grub - program to generate GRUB's menu.lst file SYNOPSIS
update-grub DESCRIPTION
update-grub is a program used to generate the menu.lst file used by the grub bootloader. It works by looking in /boot for all files which start with "vmlinuz-". They will be treated as kernels, and grub menu entries will be created for each. It will also create the initial menu.lst if none exists, after prompting the user. It will also add initrd lines for ramdisk images found with the same version as kernels found. e.g. /boot/vmlinuz-2.4.5 and /boot/initrd-2.4.5 will cause a line of "initrd=/boot/initrd-2.4.5 or similar to be added for the ker- nel entry in the menu.lst. After update-grub has been run for the first time, the user is required to edit the generated menu.lst. The user must set the two options update-grub uses. Then re-run the update-grub script to update the menu.lst file using the default's that have been set. These are the options passed to the linux kernel: # kopt=root=/dev/hda1 ro Everything after "kopt=" is passed to the kernel as parameters. See bootparam(7) for more information. This is the grub device from which grub loads the kernel: # groot=(hd0,1) (hd0,1) is a partition in grub notation. See grub(8) for more information. This option controls if grub should create the alternative boot options in the menu entries # alternative=true # alternative=false This option controls if grub should lock the alternative boot options see grub(8) for more information. # lockalternative=true # lockalternative=false This option controls if grub should lock the old kernels. # lockold=true # lockold=false This options controls what is used for the alternative boot options, multiple altoptions lines are allowed. # altoptions=(some description) some kernel command line options # altoptions=(recovery option) single The description is placed in '()' and the kernel command line options follow that. # updatedefault=true # updatedefault=false This option controls if grub should update the default entry to keep booting the same kernel even if a new one is installed. The update-grub script can be ran automagically from the /etc/kernel-img.conf file by adding the following lines: postinst_hook = update-grub postrm_hook = update-grub do_bootloader = no For further information related to /etc/kernel-img.conf, see the manpage kernel-img.conf(5). SEE ALSO
grub(8), grub-install(8), kernel-img.conf(5) (contained in the kernel-package package), bootparam(7). The full documentation for grub is maintained as a Texinfo manual in the grub-legacy-doc package. If the info and grub programs are prop- erly installed at your site, the command info grub should give you access to the complete manual. AUTHOR
This manual page was written by Jason Thomas <jason@debian.org>, for the Debian GNU/Linux system (but may be used by others). Jason Thomas June 18, 2001 update-grub(8)
All times are GMT -4. The time now is 06:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy