Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract part of $USER in script Post 303022367 by RudiC on Thursday 30th of August 2018 05:19:29 PM
Old 08-30-2018
I moved the thread to "UNIX for Beginners Questions & Answers" - and closed it. Please comply to the forum rules that you accepted when you registered: post homework / classwork in the home- and coursework forum respecting the home- and coursework rules.


Nevertheless, a few comments to your post:


  • A shell (and every other) variable has a value / contents that does not change depending on how it is used / evaluated. So $USER will show the same, be it echoed or printfed.
  • Urgent ("really need help") posts are deprected in here and don't get increased attention nor are they preferredly answered.
  • Heed what other, longer term members (here: bakunin) are suggesting on how to prepare a post so people ready to answer don't need to guess about what be the real problem.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extract a part of file name

Hi, I want to extract a part of filename and pass it as a parameter to one of the scripts. Could someone help. File name:- NLL_NAM_XXXXX.XXXXXXX_1_1.txt. Here i have to extract only XXXXX.XXXXXXX and the position will be constant. that means that i have to extract some n characters from... (6 Replies)
Discussion started by: dnat
6 Replies

2. Shell Programming and Scripting

extract last part of string.

Hi, I have a string like this BUNDLE=/home/bob/flx/user.bun how to extract only the the last part ie, only user.bun (2 Replies)
Discussion started by: vprasads
2 Replies

3. Shell Programming and Scripting

How to extract one part from whole output

Hi All, I am trying to write a small shell programming to get db2 database size info. The command I am going to use is- db2 "CALL GET_DBSIZE_INFO(?, ?, ?, -1)" and the output of above command generally is- Value of output parameters -------------------------- Parameter Name :... (4 Replies)
Discussion started by: NARESH1302
4 Replies

4. Shell Programming and Scripting

how to extract a certain part of a line

Hi friends, I want to select and use the certain part of a line. For example I have the following line home/1245/hgdf/acsdf/myhome/afolder/H2O/endfile how can I extract the part " /myhome/afolder/H2O/endfile " thanks (6 Replies)
Discussion started by: rpf
6 Replies

5. Shell Programming and Scripting

extract part of hostname in a script

I need to automate something as part of post processing in a script . Each project is identified by a 3 letter string which is part of hostname and based on hostname I need to copy a particular file to that machine from my distribution . here are hostnames pprdifeap01.corp.host.net (where... (1 Reply)
Discussion started by: gubbu
1 Replies

6. Shell Programming and Scripting

Help with extract particular part of data

Input file <data> <temporary>qe2qrqerq qwewqeqwrqwrq qrerwrewrwer </temporary> </data> <sample>@!@##%#</sample> <info>12345</info> <content>2313214141454</content> <data> <temporary>qe2qrqerq qrerwrewrwer </temporary> <content>123214214523</content> </data>... (5 Replies)
Discussion started by: perl_beginner
5 Replies

7. Shell Programming and Scripting

Extract part of a string

I have a file with 100s of lines of text. I want to perform an extraction of this line: Info bpzs(pid=2652) using 1000 bits I have not been able to extract it. Should I try expr match or is there another method? This line has data both in front of and in back of it. I do not have grep -o... (5 Replies)
Discussion started by: newbie2010
5 Replies

8. Shell Programming and Scripting

Extract part of file

Hello All, I need to extract part of a file into a new file My file is Define schema xxxxxx Insert into table ( a ,b ,c ,d ) values ( 1, 2, 3, (15 Replies)
Discussion started by: nnani
15 Replies

9. UNIX for Advanced & Expert Users

Need help to extract part of the string

Hi, I have a string with name as 20140412-s1-Potopolive_promos_20140412. So I want to extract only Potopolive string. Could you please help me the command. O/p : Potopolive Thx in advance (5 Replies)
Discussion started by: lkeswar
5 Replies

10. Shell Programming and Scripting

Substr/Instr in shell script or extract part of text

Hi, I need to extract part of a text to two variables text is "PL/SQL procedure successfully completed. ERROR ----------------------------------------------------------------- Test Error Message PLUSVAR ---------- 1" I want "Test Error Message" in one variable and "1" in another variable.... (11 Replies)
Discussion started by: vedavrath
11 Replies
DROPUSER(1)						  PostgreSQL Client Applications					       DROPUSER(1)

NAME
dropuser - remove a PostgreSQL user account SYNOPSIS
dropuser [ options... ] [ username ] DESCRIPTION
dropuser removes an existing PostgreSQL user and the databases which that user owned. Only users with usesuper set in the pg_shadow table can destroy PostgreSQL users. dropuser is a shell script wrapper around the SQL command DROP USER [drop_user(7)] via the PostgreSQL interactive terminal psql(1). Thus, there is nothing special about removing users via this or other methods. This means that the psql must be found by the script and that a database server is running at the targeted host. Also, any default settings and environment variables available to psql and the libpq front-end library do apply. OPTIONS
dropuser accepts the following command-line arguments: username Specifies the name of the PostgreSQL user to be removed. This name must exist in the PostgreSQL installation. You will be prompted for a name if none is specified on the command line. -e --echo Echo the queries that dropuser generates and sends to the server. -i --interactive Prompt for confirmation before actually removing the user. -q --quiet Do not display a response. createuser also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as (not the user name to drop) -W --password Force password prompt (to connect to the server, not for the password of the user to be dropped). ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters DIAGNOSTICS
DROP USER All is well. dropuser: deletion of user "username" failed Something went wrong. The user was not removed. If there is an error condition, the backend error message will be displayed. See DROP USER [drop_user(7)] and psql(1) for possibilities. EXAMPLES
To remove user joe from the default database server: $ dropuser joe DROP USER To remove user joe using the postmaster on host eden, port 5000, with verification and a peek at the underlying query: $ dropuser -p 5000 -h eden -i -e joe User "joe" and any owned databases will be permanently deleted. Are you sure? (y/n) y DROP USER "joe" DROP USER SEE ALSO
createuser(1), DROP USER [drop_user(7)] Application 2002-11-22 DROPUSER(1)
All times are GMT -4. The time now is 02:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy