Sponsored Content
Full Discussion: Delete function
Top Forums UNIX for Dummies Questions & Answers Delete function Post 5530 by Ohji on Thursday 16th of August 2001 08:28:19 AM
Old 08-16-2001
Delete function

I need to delete a certain data in a file. May I know how to do it by using awk, sed any shell command?

For example, i have a file details.dat. The user will search in that file for a particular field and if match, he will delete the whole record. Do you know how to do it?

Last edited by Ohji; 08-16-2001 at 09:27 PM..
 

9 More Discussions You Might Find Interesting

1. Programming

How to delete N bytes from the starting of the file from a C function???

Hi, I want to delete the initial few lines (or even bytes) from a file. I want to do this from a C function & this is in Linux platform. The truncate & ftruncate is allowing me to delete bytes from the end only. Any linux C function calls or ideas or any suggestions?? I'm in a dead... (2 Replies)
Discussion started by: jockey007
2 Replies

2. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

3. Shell Programming and Scripting

Return a value from called function to the calling function

I have two scripts. script1.sh looks -------------------------------- #!/bin/bash display() { echo "Welcome to Unix" } display ----------------------------- Script2.sh #!/bin/bash sh script1.sh //simply calling script1.sh ------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies

4. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

5. Programming

How to step in one function after the function be executed in gdb?

In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies

6. Shell Programming and Scripting

Help to Modify File Name in each function before calling another function.

I have a script which does gunzip, zip and untar. Input to the script is file name and file directory (where file is located) I am reading the input parameters as follows: FILENAME=$1 FILEDIR=$2 I have created 3 functions that are as follows: 1) gunzip file 2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies

7. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

8. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

9. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
USERDB(8)						      Double Precision, Inc.							 USERDB(8)

NAME
userdb - manipulate /etc/courier/userdb SYNOPSIS
userdb {addr} set {field=value...} userdb {addr} unset {field...} userdb {addr} del userdb {path/addr} [set | unset | del] ... userdb -f {file} {adr} [set | unset | del] ... userdb -show {path} userdb -show {path} {addr} userdb -show -f {file} userdb -show -f {file} {addr} DESCRIPTION
userdb is a convenient script to individually manipulate entries in /etc/courier/userdb. See makeuserdb(8)[1] for a description of its contents. /etc/courier/userdb can always be edited using any text editor, but userdb is a convenient way to modify this file from another script. /etc/courier/userdb can also be a subdirectory, instead of a file. Specify foo/bar/addr to manipulate addr in the file /etc/courier/userdb/foo/bar. You can also use the -f flag: -f /etc/courier/userdb/foo/bar is equivalent. Use whatever form makes the most sense to you. /etc/courier/userdb must not have any group or world permissions. That's because its contents may include system passwords (depending upon the application which uses this virtual user account database). Each line in /etc/courier/userdb takes following form: addr specifies a unique virtual address. It is followed by a single tab character, then a list of field=value pairs, separated by vertical slash characters. See makeuserdb(8)[1] for field definitions. A text editor can be used to add blank lines or comments in /etc/courier/userdb. Any blank lines or comments are ignored by the userdb script. The names of the actual fields, and their contents, are defined entirely by applications that use the /etc/courier/userdb database, the userdb command just adds or removes arbitrary fields. For example: userdb default/info set mail=/home/mail/info This command accesses the address "info" in /etc/courier/userdb/default. If the second argument to userdb is "set", the remaining arguments are taken as field=value pairs, which are added to the record for addr. If there is no record for addr, a new record will be appended to the file. If addr exists, any existing values of any specified fields are removed. If =value is missing, userdb stops and prompts for it. This is useful if you're setting a password field, where you do not want to specify the password on the command line, which can be seen by the ps(1) command. If userdb is being executed by a script, the value can be provided on standard input. Use "unset" to delete fields from an existing record. Use "del" to delete all fields in the existing record, plus the record itself. DISPLAYING /etc/courier/userdb If the first argument to userdb is -show, userdb displays the contents of /etc/courier/userdb. If /etc/courier/userdb is a subdirectory, path must refer to a specific file in /etc/courier/userdb. The -f option can be used instead of path in order to specify an arbitrary file. If addr is not specified, userdb produces a list, on standard output, containing all addresses found in the file, on per line. If addr is specified, userdb produces a list, on standard output, of all the fields in /etc/courier/userdb for this addr. REBUILDING /etc/courier/userdb.dat The actual virtual account/address database is /etc/courier/userdb.dat. This is a binary database file. /etc/courier/userdb is the plain text version. After running userdb, execute the makeuserdb(8)[1] command to rebuild /etc/courier/userdb.dat for the changes to take effect. BUGS
addr must be unique. If /etc/courier/userdb is a subdirectory, it's possible to create the same addr in different files in the subdirectory. This is an error that is not currently detected by userdb, however the subsequent makeuserdb(8)[1] command will fail with an error message. FILES
/etc/courier/userdb - plain text file, or directory of plain text files .lock.filename - lock file for filename .tmp.filename - temporary file used to create new contents of filename SEE ALSO
makeuserdb(8)[1], userdbpw(8)[2] NOTES
1. makeuserdb(8) makeuserdb.html 2. userdbpw(8) userdbpw.html Double Precision, Inc. 08/23/2008 USERDB(8)
All times are GMT -4. The time now is 01:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy