FTP search ,grep using perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP search ,grep using perl
# 15  
Old 04-23-2013
Yes!!! Smilie
# 16  
Old 04-23-2013
Okay, that changes things, when you just want a first and last number instead of a bunch of individual filenames. Working on it.
# 17  
Old 04-23-2013
Code

This is what my initial posting was .Sorry if the message was not conveyed properly .

I have a list of file names in a file and would like to search/grep the same names in the list of files on the ftp server and output to a file.

Let me brief it again .

my file.txt has few numbers

Ftp server has list of 13000 files.

based on my list which has 10 or 100 names of the file names and i want to see if those 10 or 100 files present on the FTP server and output to the file
# 18  
Old 04-23-2013
That's just confusing the matter even more...

What do these numbers in files.txt actually mean if you're not actually looking for their literal strings? Are they ordered in ranges, first \n last \n first \n last \n first \n last \n ? Or what?
# 19  
Old 04-23-2013
Let me tell you in Unix

Code:
$ ls -l |grep 471560-99999-2013.op.gz
-rw-r-----   1 ara2wj   nagp           0 Apr 23 14:23 471560-99999-2013.op.gz
(example files on the ftp server )

$ ls -l |grep 471560
-rw-r-----   1 ara2wj   nagp           0 Apr 23 14:23 471560-99999-2013.op.gz
(in my file i have 471560)

My file.txt has list of partial name of the files that are present ftp server, I need to search/grep on the ftp server to see if they are present and get the result to an output saying that they are there on the server
# 20  
Old 04-24-2013
So you don't want a range match now? You do want literal strings?

The program as given works here... Perhaps you're in the wrong directory, perhaps you're not looking for where your files are appearing, perhaps you don't have permissions to write to the current folder, perhaps you don't have permissions to retrieve the files, or perhaps your search strings contain garbage you didn't intend (carriage returns?)

Last edited by Corona688; 04-24-2013 at 11:30 AM..
# 21  
Old 04-24-2013
Yes i am looking for literal strings.


Perhaps you're in the wrong directory,
There is only one directory to search for the files

perhaps you're not looking for where your files are appearing,
Where should we look for the appearing files .

perhaps you don't have permissions to write to the current folder,
I dont need any permission as we are not putting or getting any file . We are just verifying if the file exist if so output to a txt file on the local server.

perhaps you don't have permissions to retrieve the files,
We are not getting any files from FTP server .

perhaps your search strings contain garbage you didn't intend (carriage returns?)
The example that i have given is a real example of the filename and the files in my text files .

Last edited by ajayram_arya; 04-24-2013 at 01:07 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

3. Shell Programming and Scripting

Perl - start search by using search button or by pressing the enter key

#Build label and text box $main->Label( -text => "Input string below:" )->pack(); $main->Entry( -textvariable => \$text456 )->pack(); $main->Button( -text => "Search", -command => sub { errchk ($text456) ... (4 Replies)
Discussion started by: popeye
4 Replies

4. Shell Programming and Scripting

Perl - use search keywords from array and search a file and print 3rd field when matched

Hi , I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code. my $current_value=12345; my @users=("bob","ben","tom","harry"); open DBLIST,"<","/var/tmp/DBinfo"; my @input = <DBLIST>; foreach (@users) { my... (11 Replies)
Discussion started by: chidori
11 Replies

5. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

6. UNIX for Dummies Questions & Answers

recursive search and ftp

Could someone help me in recursive search and ftp'ing the files to remote server? The host machine will have /dir1/dira/list_of_files1 /dir1/dirb/list_of_files2 /dir1/dirc/list_of_files3 . . . so., I need to search from dir1 recursively (only one level down) and find all the files that... (1 Reply)
Discussion started by: brahmi
1 Replies

7. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

8. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

9. Shell Programming and Scripting

using finddepth in ftp to search for directories in perl

Hi all, I have script which downloads the build and copies onto the local machine I am able to download files in a directory, but unable to get the files in subdierctories. I am using finddepth to search for sub directories but I am unable to do so. Here is my code: ... (0 Replies)
Discussion started by: gurukottur
0 Replies
Login or Register to Ask a Question