Visit The New, Modern Unix Linux Community


Generate class path dynamically based on source path


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generate class path dynamically based on source path
# 1  
Generate class path dynamically based on source path

Hi experts,

I have multiple file names ending with .jsp located in
Code:
$SOME_DIR, $SOME_DIR/f1/,$SOME_DIR/f2/test,$SOME_DIR/f3/fa

and there are equivalent class files in
Code:
 $SOME_DIR/WEB-INF/classes/_pages,$SOME_DIR/WEB-INF/classes/_pages/_f1, $SOME_DIR/WEB-INF/classes/_pages/_f2/_test,$SOME_DIR/WEB-INF/classes/_pages/_f3/_fa

I have to write a script to match class file for each jsp file
ex:
Code:
Name: test.jsp 
Located in $SOME_DIR/f2/test
I have to check for _test.class in $SOME_DIR/WEB-INF/classes/_pages/_f2/_test (There is underscore in the path of the class)

if this class is not present then do something

I am doing find on $SOME_DIR for jsps and running basename on

Code:
for i in $( find $SOME_DIR -name '*.jsp'|  sed "s|$SOME_DIR/||;"); 
do 
echo jsp file $i
class_name==_$(echo $(basename $i)|cut -d'.' -f1).class
echo class name is $class_name
#now this _test.class file is present  in $SOME_DIR/WEB-INF/classes/_pages/_f2/_test
#$SOME_DIR/WEB-INF/classes/_pages directory or its sub directories is where all class files are present
done

Source of jsp is $SOME_DIR/f2/test
Destination of equivalent class is located in #$SOME_DIR/WEB-INF/classes/_pages/_f2/_test

logical code of destination path for a given .jsp will be $SOME_Dir+WEB_INF+classes+_pages+(dirname $i minus $SOME_DIR with underscore)

I am not really sure how to generate class path based on source path dynamically.

---------- Post updated 12-19-16 at 04:27 PM ---------- Previous update was 12-18-16 at 05:25 PM ----------

Resolved myself. I will post the solution...

Last edited by oraclermanpt; 12-18-2016 at 07:05 PM.. Reason: fixed spell mistakes

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #527
Difficulty: Medium
ASCII was originally developed in the early 1940s.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

2. Web Development

Path to javascript source code at local browsing

Where should I put my javascript source code in order to run it "locally" by file not by http?---not sure this "locally" is the appropriate word here. My test is when my javascript code (test.js) is put in the site default folder as the test.html in /var/www/html both worked as expected with... (2 Replies)
Discussion started by: yifangt
2 Replies

3. Shell Programming and Scripting

I am trying to merge all csv files from source path into 1 file

I am trying to merge all csv files from source path into one single csv file in target. but getting error message: hadoop fs -cat /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/TCH-charge_*.csv > /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/final/TCH_pb_charge.csv getting error message:... (0 Replies)
Discussion started by: cplusplus1
0 Replies

4. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

5. Shell Programming and Scripting

Dynamically referencing a Path

How would I reference a source path (where I have a script pulling data from) that changes location? For example, a Mail folder is being used as a source to pull some data, but somebody could move the folder around in the GUI of Mail, changing it's location in the filesystem (that I am referencing... (11 Replies)
Discussion started by: sudo
11 Replies

6. Shell Programming and Scripting

Setting class path

hi , can anybody help me to chage the class path in unix server.. what are the files need to update .... (2 Replies)
Discussion started by: Madhu Siddula
2 Replies

7. Shell Programming and Scripting

Generate a DML dynamically based off of header record

I have the following scenario where I need to use a header record from a file and generate a DML based off of it... E.g.: The header can change periodically with an additional column in between or remove a col.... Sample header : (head -1 sample.txt)... (17 Replies)
Discussion started by: anduzzi
17 Replies

8. UNIX for Dummies Questions & Answers

Source path

what is the command for moving a file with it's original source path ? (8 Replies)
Discussion started by: Oggie25
8 Replies

9. UNIX for Advanced & Expert Users

SCP wihout a source path

Hi, I hope someone can explain if this is the right behaviour. I regularly use scp to copy files between hosts like this: scp -prv user@remotehost:/path/to/copy . However, today, I made a mistake and typed this instead: scp -prv user@remotehost: /path/to/copy . This started copying... (6 Replies)
Discussion started by: zlowryder
6 Replies

10. Linux

rpmbuild, how to specify a different source and destination path for files

I'd like to specify a different build and deployment path for files, by default the same path is used for both build and install, I wasn't able to find a way to make these different. With Solaris pkgadd, one can specify different paths in prototype, so I would assume something like that is possible... (0 Replies)
Discussion started by: tiburblium
0 Replies

Featured Tech Videos