Sponsored Content
Top Forums Shell Programming and Scripting To find ls of similar pattern files in a directory by passing the variable. Post 302877203 by satishmallidi on Friday 29th of November 2013 01:08:12 AM
Old 11-29-2013
To find ls of similar pattern files in a directory by passing the variable.

Hi,

I have file in my $datadir as below :-
Code:
SAT_1.txt
SAT_2.txt
BAT_UD.lst
BAT_DD1.lst
DUTT_1.txt
DUTT_la.txt

Expected result :-
should get all the above file in $<Filename>_file.lst


Below is my code :-
Code:
 
for i in SAT BAT DUTT
do
touch a.lst
cd $datadir
ls -1 $i_* >> $i_file.lst
done

problem :-
ls -1 $i_* is getting read as ls -1 *

Am i missing anything ..Plz help me out.


Thanks inn advance.


Regards,
Satish.

Last edited by vbe; 11-29-2013 at 06:14 AM.. Reason: code tags please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find required files by pattern in xml files and the change the pattern on Linux

Hello, I need to find all *.xml files that matched by pattern on Linux. I need to have written the file name on the screen and then change the pattern in the file just was found. For instance. I can start the script with arguments for keyword and for value, i.e script.sh keyword... (1 Reply)
Discussion started by: yart
1 Replies

2. Shell Programming and Scripting

concatenating similar files in a directory

Hi, I am new in unix. I have below requirement: I have two files at the same directory location File1.txt and File2.txt (just an example, real scenario we might have File2 and File3 OR File6 and File7....) File1.txt has : header1 record1 trailer1 File2.txt has: header2 record2... (4 Replies)
Discussion started by: Deepak62828r
4 Replies

3. Shell Programming and Scripting

How to find files in a pattern directory?

Hi, I have more than 1000 directories under one directory (lets says under /home/). Sub directories are like A1 to A100,B1 to B100 etc.. Here my problem is I need to find the files older than 10 days in the directories which starts with A*. I tried some thing like this which is not... (2 Replies)
Discussion started by: shhrikanth
2 Replies

4. UNIX for Dummies Questions & Answers

Delete X amount of similar files in a directory

Need a Unix command to save the last 20 versions of a file in a specific directory and delete everything else. Date is irrelevant. Anyone aware of such an animal? In my test, I came up with: ls -t1 /tmp/testfile* | tail -n +20 | xargs rm I don’t quite trust the author though! (1 Reply)
Discussion started by: rwsherman
1 Replies

5. Shell Programming and Scripting

Find the similar directory

Hi I have one directory whose name i don't remember exactly only starting letter i know which is Resp. Can you please let me know the command to find the similar directory in the root. Rajesh (3 Replies)
Discussion started by: guddu_12
3 Replies

6. Shell Programming and Scripting

How to find similar values in different files

Hello, I have 4 files like this: file1: cg24163616 15 297 cg09335911 123 297 cg13515808 565 776 cg12242345 499 705 cg22905282 225 427 cg16674860 286 779 cg14251734 303 724 cg19316579 211 717 cg00612625 422 643 file2:... (2 Replies)
Discussion started by: linseyr
2 Replies

7. Shell Programming and Scripting

Looking to find files that are similar.

Hello all, I have a server that is running AIX, running a tool that converts various printstreams (AFP/Metadata) to PDF. This is done using a rexx script and an off the shelf utility. Each report (there's around 125) uses a certain script file, it's basically a text file. I am trying... (5 Replies)
Discussion started by: jeffs42885
5 Replies

8. UNIX for Dummies Questions & Answers

Find next line based on pattern, if it is similar pattern skip it

Hi, I am able to get next line if it is matching a particular pattern. But i need a way to skip if next line also matches same pattern.. For example: No Records No Records Records found got it Records found Now i want to find 'Records found' after 'No Records' pattern matches.. ... (5 Replies)
Discussion started by: nagpa531
5 Replies

9. Shell Programming and Scripting

Finding files in directory with similar names

So, I have a directory tree that has many files named thusly: X_REVY.PDF I need to find any files that have the same X portion (which can be nearly anything) as any another file (in any directory) but have different Y portions (which can be any number from 1-99). I then need it to return... (3 Replies)
Discussion started by: Kamezero
3 Replies

10. Shell Programming and Scripting

How to move the files older than x days with similar directory structure?

Hello, I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure. for example: /XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt I know about find /XYZ -type f -mtime +14... (3 Replies)
Discussion started by: prvnrk
3 Replies
LCP_CRTPOLLIST(8)						   User Manuals 						 LCP_CRTPOLLIST(8)

NAME
lcp_crtpollist - create an Intel(R) TXT policy list SYNOPSIS
lcp_crtpollist COMMAND [OPTION] DESCRIPTION
lcp_crtpollist is used to create an Intel(R) TXT policy list. OPTIONS
--create Create an TXT policy list. The following options are available: --out file policy list file [--ver version] version [file]... policy element files --sigh Sign an TXT policy list. --pub key-file PEM file of public key --out file policy list file [--priv key-file] PEM file of private key [--rev rev-ctr] revocation counter value [--nosig] don't add SigBlock --addsig --sig file file containing signature (big-endian) --out file policy list file --show file policy list file --help Print out the help message. --verbose Enable verbose output; can be specified with any command. EXAMPLES
Create policy list: Assuming there have been two element file mle.elt and pconf.elt generated by lcp_crtpolelt(8) The following example can create an unsigned policy list: lcp_crtpollist --create --out list-unsig.lst mle.elt pconf.elt Sign policy list: Unsigned policy list can be signed by the command lcp_crtpollist(8) or openssl(1). The openssl(1) signing is supported for cases where the signing environment is separate from the policy creation environment and the software allowed to run there is strictly controlled and already supports openssl(1). The following example uses openssl(1) to sign the list: 1 openssl rsa -pubout -in privkey.pem -out pubkey.pem 2 cp list-unsig.lst list-sig.lst 3 lcp_crtpollist --sigh --pub pubkey.pem --nosig --out list-sig.lst 4 openssl genrsa -out privkey.pem 2048 5 openssl dgst -sha1 -sign privkey.pem -out list.sig list-sig.lst 6 lcp_crtpollist --addsig --sig list.sig --out list-sig.lst lcp_crtpollist can also be used to sigh a policy list. The following example are intended to be mutually exclusive with the preceding exam- ple. 1 openssl genrsa -out privkey.pem 2048 2 openssl rsa -pubout -in privkey.pem -out pubkey.pem 3 cp list-unsig.lst list-sig.lst 4 lcp_crtpollist --sign --pub pubkey.pem --priv privkey.pem --out list-sig.lst SEE ALSO
lcp_crtpol2(8), lcp_crtpolelt(8), lcp_crtpollist(8), openssl(1). tboot 2011-12-31 LCP_CRTPOLLIST(8)
All times are GMT -4. The time now is 09:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy