Sponsored Content
Top Forums Shell Programming and Scripting Help with database deleting data!!! Post 302647081 by Lina_14 on Sunday 27th of May 2012 07:08:27 AM
Old 05-27-2012
Thank you for your replay

The problem is that when I record data, I want to delite not only the file but also the data from the database :/, I would apreciate any kind of help.
Code:
i="y"
echo "Enter name of database "
read db
while [ $i = "y" ]
do
clear
echo "1.Enter id "
echo "2.Display current dir"
echo "3.Listing the dir"
echo "4.Make a dir"
echo "5.Copy a file"
echo "6.Rename file"
echo "7.Delete file"
echo "8.Edit file"
echo "9.Shto regjistrim"
echo "10.Exit"
echo "Enter your choice"
read ch
case $ch in

1)echo "Enter id "
read id
grep -i "$id" $db;;
2)echo "Current Dir is : "
  pwd;;
  3)echo "Directories are"

    ls;;
    4)echo "Enter dir name to create"
     read d
             mkdir $d
                 echo $d" Dir is created";;
             5)echo "Enter filename from copy"
              read f1
               echo "Enter filenm2 to be copied"
                read f2
                    #cat $f1 > $f2
                        cp $f1 $f2
                            echo $f2" is copied from "$f1;;
                        6)echo "Enter file name to rename"
                         read f1
                          echo "Enter new name of file"
                           read f2
                                   mv $f1 $f2
                                       echo $f1" is renamed as "$f2;;
                                   7)echo "Enter any filenm to be delete"
                                    read f1
                                            rm $f1
                                                echo $f1" is deleted";;
                                            8)echo "Enter any file to be editing "
                                             read f1
                                                     vi $f1;;
9)echo "Enter the name"
read kdi
echo “$kdi” > dbkodi
cat dbkodi
echo "Enter the profesion:"
read tpi
echo ”$tpi” > dbtitulli
cat dbtitulli
echo "Enter the school "
read ept
echo “$ept” > dbemri_piktorit
cat dbemri_piktorit
echo "Enter the class"
read cmm
echo ”$cmm” >dbcmimi
cat dbcmimi
echo "$kdi $tpi $ept $cmm">>$db;;

                                                 10)echo "Have a nice time"
                                                 exit;;
                                                 *)echo "Invalid choice entered";;
                                                 esac
                                                 echo "Do u want to continue ? "
                                                 read i
                                                 if [ $i != "y" ]
                                                 then
                                                 exit
                                                 fi
                                                 done


Last edited by Scott; 05-27-2012 at 08:45 AM.. Reason: Use code tags, please and indent your code properly
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving data from one database to other

Dear All, I have 2 databases, There is a lot of data in both the databases, i would like to move some data from one database to the other. I would like to accept 2 parameters from the user, i.e. emplyee id & dept, on entering the 2 i will unload all the data from the tables to the flat files.... (6 Replies)
Discussion started by: lloydnwo
6 Replies

2. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

3. Shell Programming and Scripting

extracting data and store in database

Hello all, I have this text file data. The data are separated by comma in three column and space or line feed to start a new row anderson helberg, Jane, brother Sister ,mother,grandpa bombay,new york, china I would like store them in the following format. field1 ... (2 Replies)
Discussion started by: mam
2 Replies

4. Shell Programming and Scripting

Deleting shorter lines from data file

Hello, I have the following data file structure: 1234 text 2345 text 3456 text text text 4567 text text text 5678 text text text 6789 text text text I simply want to delete all of the lines that only have one text column (i.e. the first two lines in this case). The output would be:... (1 Reply)
Discussion started by: palex
1 Replies

5. Shell Programming and Scripting

Script problem with deleting data

The 10.Delete data doesnt work at all, plesase anyone could help on that. When I choose options 10 to delete a record it only copy the selected data on the other file dbs1 but doesnt delete it from the database where other records are. #! /bin/bash i="y" echo "Enter name of database " read db... (6 Replies)
Discussion started by: Lina_14
6 Replies

6. Shell Programming and Scripting

Mask the Oracle Database Data

Hi, We have to mask the data that is coming from production environment to Non-production environment. The database is running in oracle platform. If anybody has generic scripts to achive this task,it would be great if that can be shared with me? Thank you, Jayaprakash. (10 Replies)
Discussion started by: bandaru_0810
10 Replies

7. UNIX for Dummies Questions & Answers

Deleting the unwanted data based on condition

hi i have my input data like this aaa bbb ccc asa dff nmj mnj saa dff oik aax cdx saa oik asq sdf dssi want my output file to be like this mnj saa dff oik aax cdx saa oiki want to retain only those lines which will have oik just below them and i want oik to be as next column to those... (1 Reply)
Discussion started by: anurupa777
1 Replies

8. Shell Programming and Scripting

Deleting data

Need Assistance in a script to delete date for Below example There are four period(.) line . I wanted to delete 2 period(.) from below . 5 .TODAY...MOSTLY SUNNY. HIGHS 58 TO 63. LIGHT WINDS IN THE MORNING 6 BECOMING NORTH 10 TO 15 MPH IN THE AFTERNOON. 7 .TONIGHT...MOSTLY CLEAR.... (5 Replies)
Discussion started by: ajayram_arya
5 Replies

9. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 08:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy