scripting for menu


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scripting for menu
# 1  
Old 04-25-2005
Question scripting for menu

Hi,

I'm writting a script to filter a cvs log and get only the modified files to move them to a specific directory to compile.

I try to filter a line and move from source to target, with no results. Could you help me?

for example, in the cvs log file appears:
cat log.txt
U project/FOLDER1/FOLDER2/org/com/package/date/file.java
P project/FOLDER1/FOLDER2/properties/file.properties

And I'd like an ouput file like this:
cat solution.txt
cp -Rfp project/FOLDER1/FOLDER2/org/com/package/date/file.java temp/classes/
cp -Rfp project/FOLDER1/FOLDER2/properties/file.properties /temp/properties/

any idea?

I thought about join 2 filtered files, but when try to do a "cat -b" only join from 1 to 9 lines.

I have somethink like that:

echo "Step 1: Sorting only 'P' , 'C' and 'U' lines from cvs export"
sorting.sh $1
echo "Step 2: Cutting 2 first chars to get line"
if [[ -r 1.temp ]]; then
{
cut -f5- -d \/ 1.temp > 2.temp
cut -b3- 1.temp > 2b.temp
cat -b 2.temp > 2d.temp
cat -b 2b.temp > 2e.temp
join 2e.temp 2d.temp > 2c.temp
#cut -b2- 2c.temp > prepare.temp
echo "Step 3: Substitute the string for deployment structure"
#filters.sh prepare.temp
echo "Applying modes and executing ..."
#sort filtered.temp | uniq > exec.temp
#chmod +x exec.temp
#exec.temp
echo "Removing temp files"
#rm *.temp
};
fi
echo "Done!"


Thanks in advance,
# 2  
Old 05-02-2005
try this one ... (you might need to add another \ to the "$2" on the awk line) ...
Code:
#!/bin/ksh
for TYPE in U P
do
    awk "/^${TYPE}/ {print \$2}" cvs.log > ${TYPE}.tmp
    if [ -s ${TYPE}.tmp ]
    then
          case ${TYPE} in
          U) TMPDIR=/temp/classes ;;
          P) TMPDIR=/temp/properties ;;
          esac
          for FILE in `< ${TYPE}.tmp`
          do
               cp -Rfp ${FILE} ${TMPDIR}
          done
     else
          echo "${TYPE} not found in cvs.log"
     fi
done

exit 0

# 3  
Old 05-02-2005
nawk -f manu.awk log.txt | sh

here's manu.awk:
Code:
$1 == "U" { dst = "temp/classes"}
$1 == "P" { dst = "/temp/properties"}
$1 == "P" || $1 == "U" { printf("cp -Rfp %s %s\n", $2, dst) }

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies

2. Shell Programming and Scripting

Menu and case statement scripting

hi all i am trying to get help with writing a script using case statement to display menu as 1) Authentication log 2) System log 3) Messages 4) Dmesg 5) Boot log Q) Exit When selecting the menu by 1 or 2 or 3 o 4 or 5, it should display the last 10 lines of the log files, if... (3 Replies)
Discussion started by: renegade11
3 Replies

3. Homework & Coursework Questions

Shell scripting/menu

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell menu program that will: a. copy a file to a designated directory b. tell you if a specified user... (13 Replies)
Discussion started by: Jagst3r21
13 Replies

4. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

5. Shell Programming and Scripting

Menu with sub-menu options

Hi! I have created on script which is working fine with menu options and with a sub-menu. I want to enhance it by using sub-options under menu options. Like. option 1) will give the list only. option 1.1) should give the option to user to choose one file, whose content user wanna see. ... (3 Replies)
Discussion started by: sukhdip
3 Replies

6. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

7. UNIX for Dummies Questions & Answers

Scripting menu problem

Hi there, I am new to Unix and at the moment I am trying to solve my assignment that is to create a script for the program to prompt user to type three codes, from user point of view it should be done by typing codes separating them by spaces. Then program displays a menu with these three... (5 Replies)
Discussion started by: Dannel
5 Replies

8. Shell Programming and Scripting

help with scripting a simple menu

Hi there. I'm trying to teach myself UNIX but the book I bought is a bit confusing. I'm trying out this exercise and I think I'm on the right track, but I'd appreciate any suggestions on how to improve what I have so far. Also, I'm not clear on how to use the read command to utilize the user's... (3 Replies)
Discussion started by: Jsmith
3 Replies

9. Shell Programming and Scripting

Scripting problem - when the file is not found i want it to return to the menu

when the file is not found i want it to return to the menu, however it carries out the next line when i hit a key I know its probably something simple can anyone help? here is my pause function: function pause(){ read -s -n 1 -p "Press any key to return to Menu . . ." echo } SCRIPT... (2 Replies)
Discussion started by: Alendrin
2 Replies
Login or Register to Ask a Question