Script Needed Urgent!!!!!!!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Needed Urgent!!!!!!!!!
# 1  
Old 10-22-2008
Script Needed Urgent!!!!!!!!!

Hi Guys,


Need a script!!!!!!!!!!!

Sample File:

./R1/new/svp920m02f.4gl
./R1/new/svp921m01.4gl
./R1/new/svp950m01.4gl
./R1/new/svp950m01d.4gl
./R1/new/svp950m01g.4gl
./R1/new/svp955m01.4gl
./R1/new/svp960m01.4gl
./R1/new/svp965m01.4gl
./R1/new/svp992m06.4gl
./R1/new/svp994m01.4gl
./R1/new/svs402a.01.per
./R1/new/svs402a.03.per
./R1/new/svs402a.08.per
./R1/new/svs920a.01.per
./R1/new/svs920a.03.per
./R1/new/svs920a.08.per
./R1/old/sv_con.4gl
./R1/old/sv_gbl.4gl
./R1/old/sv_sosi_funcs.4gl
./R1/old/sva005a_en_CA.fgl
./R1/old/sva005a_en_US.fgl
./R1/old/sva005a_fr_CA.fgl
./R1/old/svm005a.fgl


i need to grep the lines with .per as extension

so the o/p wil be :::

./R1/new/svs402a.01.per
./R1/new/svs402a.03.per
./R1/new/svs402a.08.per
./R1/new/svs920a.01.per
./R1/new/svs920a.03.per
./R1/new/svs920a.08.per

And then i need to take the pattern

svs402a
svs402a
svs402a
svs920a
svs920a
svs920a

from the above results...

Kindly help me out in this!!!!!!!!!
# 2  
Old 10-22-2008
hi aajan

#script test.sh
#!/bin/sh
grep svs <file_name> | cut -d/ -f4 | cut -c1-7

Use this command, it woks... for your above requirement
# 3  
Old 10-22-2008
or in sed

Code:
sed -n 's/.*\/\(svs[0-9]\{3\}a\).*\.per/\1/p' infile

# 4  
Old 10-22-2008
use this script

you can as well type in at console


cat samplefile.txt|grep pattern | awk -F/ '{print $4}' | awk -F. '{print $1}'

out put would be ready.

Note: this works only if your files look like this ./R1/new/svs402a.01.per
# 5  
Old 10-23-2008
cat oldfl|grep ".per"|awk -F/ '{print $4}'|awk -F. '{print $1}'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent simple script needed

Good Day All, I need your urgent support to get the following script (bash), (it should be as simple as possible please) : The script will check the .csv file( attached example) The script will generated 3 files from the initial one. The script must check one field “NEType”, and then ... (2 Replies)
Discussion started by: engkemo2002
2 Replies

2. Shell Programming and Scripting

Urgent help needed to write a script

User have given me about 450 commands, i just wanted to know the full path for those commands and the output should be redirected to a separate file. Instead of running "which" command each time to find the path for all those commands, i need to do this in a simple way by a script. which... (3 Replies)
Discussion started by: pgmax
3 Replies

3. Shell Programming and Scripting

Needed urgent help with shell script

Hi, Thanks for the reply to the previous posting.I need a shell script to the following.I am entirely new to the comapny and please help me with this. 1) Create the file with a timestamp i.e. nrt_readership.mmddyyyyhhmm 2) The processing job will look for files of the pattern... (0 Replies)
Discussion started by: pharishraja
0 Replies

4. Shell Programming and Scripting

URGENT: Script/Function needed to read text property files in block wise

Hi, Iam in a need for a script/function in KSH where I want to read a text file (property file) in block by block. Here is the example: Heading Name Descripton Block Block1 Value1 Description Property Name Value Property Name Value Property Name Value Property Name Value Property Name... (7 Replies)
Discussion started by: ysreenivas
7 Replies

5. Shell Programming and Scripting

script needed... urgent

Hi.. I need help to write script (shell script/TCL) which finds the no of elapsed days from current month to coming month. Actually i have written one Tcl script to get current time... i.e. set time -format %c ] puts "TIME STAMP :$time" it prints : TIME STAMP :Mon Mar... (0 Replies)
Discussion started by: arp@g7
0 Replies

6. Shell Programming and Scripting

Script Needed Urgent in shell or PERL!!!!!!!!!!!!!!!!!!!!

My I/p FIle #%npr # { { collectionBeginTime_Date 19Jul2007 granularityPeriod 900 NODEID BSC19 RLC_Raw_Blocksize_CS2 2048 START_DATE 19Jul07 measTimeStamp_Date 20Jul2007 COLLECTION_INTERVAL_MINS 15 RLC_User_Blocksize_CS2 1024 ... (1 Reply)
Discussion started by: aajan
1 Replies

7. Shell Programming and Scripting

script needed urgent

Lot of dump files are created and filling up our file system. ( i.e. /Aix/app/clone1/heapdump659904.1188950424.txt, Aix/app/clone2/heapdump87878.88798.txt) . We got an alert that the filesystem was full and saw there were heapdumps from a few months ago that we didn't know about. It would be... (2 Replies)
Discussion started by: jayaramanit
2 Replies

8. Shell Programming and Scripting

Script Needed!!!!!!!! Urgent

How to find unique lines in a file without using 'uniq' and 'sort' command in k shell... (3 Replies)
Discussion started by: aajan
3 Replies

9. UNIX for Dummies Questions & Answers

Urgent Script Needed

I need shell script code for the following 1. Read syscat.columns after connecting to DB2 using SQL cursor 2. Read the output of the previous SQL command in the shell script 3. Perform insertions and deletions in the output of step 1 Thanks (1 Reply)
Discussion started by: skyineyes
1 Replies

10. Solaris

Urgent help needed - shell script

Dear friends, I am trying to prepare a shell script which do the following task. Being a beginner in scripting I need a bit of help from you all for shell script which does the following job. 1.Check for existence of a file in a shared directory (at some remote location ) once in a day ... (3 Replies)
Discussion started by: aarora_98
3 Replies
Login or Register to Ask a Question