Sponsored Content
Top Forums Shell Programming and Scripting Unable to do grep in a script Post 302994393 by dsid on Wednesday 22nd of March 2017 11:55:43 AM
Old 03-22-2017
Hi, sorry forgot to paste the output last time around. variables are getting expanded, just that when expansion for the path needs to occur in the grep command, things are not working out. I tried do to ls manually and the path is there.

Code:
dsiddiq:P7_LIVE:omnftppa:/home/dsiddiq> ./extract80byte.sh
+ list_file=lst
+ enc_tar_xtnsn=tar.gz.enc
+ xtr_flptrn1=bw3-syst_INST
+ echo 'Enter file processing date [YYYYMMDD]'
Enter file processing date [YYYYMMDD]
+ read file_x_date
20170219
+ echo 'Inst nu:'
Inst nu:
+ read inst_nmb
19
++ echo 20170219
++ awk '{print substr($0,1,6)}'
+ yr_mnth=201702
++ echo 20170219
++ awk '{print substr($0,7,8)}'
+ only_dt=19
+ xtr_flnm_list=bw3-syst_INST19-20170219.lst
+ xfile_pth=/backup/omnftppasrv/bw3/201702
+ enc_tar_filename=bw3-syst_INST19-20170219.tar.gz.enc
+ cmptl_extr_enc_file=/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170219.tar.gz.enc
+ echo /backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170219.tar.gz.enc
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170219.tar.gz.enc
+ echo 'filename to extract'
filename to extract
+ read flnm_80byte
20170219_HMS_80Byte_PAYbig3_1_4.prc
+ [[ 20170219_HMS_80Byte_PAYbig3_1_4.prc =~ .*\.prc ]]
+ echo 'correct file name'
correct file name
+ flnm_80BYTE=20170219_HMS_80Byte_PAYbig3_1_4.prc
+ echo 'calling func_xtract_file'
calling func_xtract_file
+ func_xtract_file
+ regex='201702[0-9][0-9]'
+ xtr_regex='bw3-syst_INST19-201702[0-9][0-9].lst'
+ cmptl_extr_list_file='/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-201702[0-9][0-9].lst'
+ /bin/grep 20170219_HMS_80Byte_PAYbig3_1_4.prc '/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-201702[0-9][0-9].lst'
grep: can't open /backup/omnftppasrv/bw3/201702/bw3-syst_INST19-201702[0-9][0-9].lst
dsiddiq:P7_LIVE:omnftppa:/home/dsiddiq>ls /backup/omnftppasrv/bw3/201702/bw3-syst_INST19-201702[0-9][0-9].lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170201.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170202.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170203.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170204.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170205.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170206.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170207.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170208.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170209.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170210.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170211.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170212.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170213.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170214.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170215.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170216.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170217.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170218.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170219.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170220.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170221.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170222.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170223.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170224.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170225.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170226.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170227.lst
/backup/omnftppasrv/bw3/201702/bw3-syst_INST19-20170228.lst

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unable to grep the following pattern

I have the following line in file1 elif ; then now if i try to grep this using following command grep -e "elif ; then" file1 it is showing nothing... how to grep such patterns (2 Replies)
Discussion started by: suri
2 Replies

2. Shell Programming and Scripting

grep or awk problem, unable to extract numbers

Hi, I've trouble getting some numbers from a html-file. The thing is that I have several html-logs that contains lines like this: nerdnerd, how_old_r_u:45782<br>APPLY: <hour_second> Verification succeded This is some of what I've extracted from a html file but all I really want is the number... (7 Replies)
Discussion started by: baghera
7 Replies

3. Shell Programming and Scripting

Log file is not getting created & unable to grep error from it

Hi All, Below is my code,what I am trying to do is redirecting output of ftp to a log file & then greping the errors but here I am unable to grep "Permission denied" error only & also the corresponding log file is also not getting created. #!/bin/sh . cfg USER='abc' PASSWD='abc123' ... (4 Replies)
Discussion started by: ss_ss
4 Replies

4. Shell Programming and Scripting

Unable to grep control/non printable characters

Unable to grep: Able to grep: (11 Replies)
Discussion started by: proactiveaditya
11 Replies

5. Shell Programming and Scripting

unable to grep the running processes.

Hi All, We have a shell script(ODS_Load)which loads the data from perticular flat file to oracle table invoking sqlplus based on the parameter. When we execute the script(ODS_Load) independently, script is working fine and able to load the tables successfully. We invoke(ODS_Load) with... (1 Reply)
Discussion started by: Nagaraja Akkiva
1 Replies

6. Shell Programming and Scripting

unable to match grep pattern

Hi All, I am trying to select all files in a directory which are not with .gz extension . for which I am using below script , but its rejecting both .gz and .z extension files,as in each letter is considered separately. PFB ls -lrt | awk '{print $9}'| egrep "^IRAMS.*$" please suggest... (1 Reply)
Discussion started by: Jcpratap
1 Replies

7. UNIX for Dummies Questions & Answers

unable to grep the reqd field

hi all, i have a data sm thg like this 28504 0 abc 148782859 42 101M nhmmmm ilopo abc 2345432 i want to get only the field which is just aftr abc i,e., 148782859, 2345432 i have used grep /abc\t/ filename to get that but its not working can any 1 help me out (5 Replies)
Discussion started by: anurupa777
5 Replies

8. UNIX for Dummies Questions & Answers

Unable to grep

I have a file with 2 lines of code Rome is in Romeo Romeo is in Rome How do I grep, so that only last line would be the outcome. sample output Romeo is in Rome I have tried with all possible greps but its resulting in both the lines in output. Please help. (6 Replies)
Discussion started by: gotamp
6 Replies

9. Shell Programming and Scripting

Unable to grep the process

I have user1 run a script called logginexpert.sh while has this line of code sleep 888I then login to another putty session with another user2 and try to grep for the logginexpert.sh process using ps -ef | grep exSunOS mymac 5.11 11.2 sun4u sparc SUNW,SPARC-Enterprise But, i dont get any... (20 Replies)
Discussion started by: mohtashims
20 Replies

10. Shell Programming and Scripting

Unable to grep using wildcard in a file.

I wish to check if my file has a line that does not start with '#' and has 1. Listen and 2. 443 echo "Listen 443" > test.out grep 'Listen *443' test.out | grep -v '#' Listen 443 The above worked fine but when the entry changes to the below the grep fails... (2 Replies)
Discussion started by: mohtashims
2 Replies
BACKUP_QUIT(8)						       AFS Command Reference						    BACKUP_QUIT(8)

NAME
backup_quit - Leaves interactive mode SYNOPSIS
quit [-help] q [-h] DESCRIPTION
The backup quit command exits interactive mode, returning the issuer to the regular shell prompt at which the backup or backup interactive command was issued to enter interactive mode. The command has no effect when issued outside interactive mode. Issuing the Ctrl-D command also exits interactive mode. CAUTIONS
To exit interactive mode, all jobs must be completed. Use the backup jobs command to list any jobs currently pending or executing, and the backup kill command to terminate them as necessary. OPTIONS
-help Prints the online help for this command. All other valid options are ignored. EXAMPLES
The following command exits interactive mode: backup> quit % PRIVILEGE REQUIRED
None SEE ALSO
backup(8), backup_interactive(8), backup_jobs(8), backup_kill(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BACKUP_QUIT(8)
All times are GMT -4. The time now is 01:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy