Sponsored Content
Full Discussion: Find and add
Top Forums Shell Programming and Scripting Find and add Post 83624 by aajmani on Friday 16th of September 2005 10:57:36 AM
Old 09-16-2005
Find and add

Hi,

I have a file with multiple lines starting with word 'newuser'. I want to go to the last line starting with 'newuser' and add another line starting with 'newuser' followed by 10 spaces and then words entered by the user. I using the following command but it does not seem to work.

sed '/*\/^newuser/ a\
newuser '$user' $file > $file.new

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and sed to find a pattern and add newline

Hello All, I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged. The issue is sometimes the processess finish at the same time or write to the file at the same time as 123 rows merged.145 rows merged. At... (5 Replies)
Discussion started by: ssikhar
5 Replies

2. Shell Programming and Scripting

awk to find pattern and add lines

My file goes like this: SID_LIST_HOSTNAME_LISTENER_3 = (SID_LIST = (SID_DESC = (SID_NAME = ORA0008) (ORACLE_HOME = /opt/oracle/product/ORA0008) (ENVS = "LD_LIBRARY_PATH=/opt/oracle/product/ORA0008/lib") ) (SID_DESC = (SID_NAME = ORA0007) ... (4 Replies)
Discussion started by: jpsingh
4 Replies

3. Shell Programming and Scripting

[Solved] Find duplicate and add pattern in sed/awk

<Update> I have the solution: sed 's/\{3\}/&;&;---;4/' The thread can be marked as solved! </Update> Hi There, I'm working on a script processing some data from a website into cvs format. There is only one final problem left I can't find a solution. I've processed my file... (0 Replies)
Discussion started by: lolworlds
0 Replies

4. UNIX for Dummies Questions & Answers

Find and add a field for an input file

Hello Sir/Madam, I'm new to UNIX and wondering if I can process a find & add using AWK command in UNIX? requirements: I have to find *.JPG field for each line in the input file and add it as a separate field for each line.. for ex: 0000684631,E,3088017,7... (10 Replies)
Discussion started by: V1l1h1
10 Replies

5. Shell Programming and Scripting

Find String and add to next column

Dear All, I have file input input01.txt 14193 40 153 14208 40 168 14283 45 243 14298 40 258 14313 41 273 14328 44 288 ... ...input02.txt 499815.5 9886300.0 14208 94.2 1957.1 499815.5 9886300.0 14208 314.2 2101.0 ... (2 Replies)
Discussion started by: attila
2 Replies

6. Programming

Perl find text and add line

Hi All I need to add a line to a file but after a certain block of text is found The block of text looks like this <RDF:Description RDF:about="urn:mimetype:video/quicktime" NC:value="video/quicktime" and i need to add this in the next line down ( note there is... (4 Replies)
Discussion started by: ab52
4 Replies

7. Shell Programming and Scripting

Find column and add numbering

Hi Masters, Kindly need your help to format this data... IMPORT_HORIZON_HEADER 0 0 35 SURFACE_DATA_FORMAT XYZ- COLOR_FORMAT RGB SURFACE EB_S1_S2_Fault1 700 3 475370.187500 3672355.250000 1513.770386 475544.281250 3672530.250000 2255.540039 (4 Replies)
Discussion started by: ipatah
4 Replies

8. UNIX for Dummies Questions & Answers

Find match between two datasetsand add value

Dear all, could you help with following: i have two large datasets that contain two columns. dataset1: 752566 rs3094315 752721 rs3131972 753541 rs2073813 760300 rs11564776 768448 rs12562034 776546 rs12124819 dataset2: 55550 0.000000 82571 0.080572 88169 0.092229... (3 Replies)
Discussion started by: kush
3 Replies

9. Shell Programming and Scripting

Perl find and add to column

Hi, Could you help me with script in perl ;A1;AAA;%/A/B;70;75;-; ;A1;AAA;%/A/C;70;75;-; ;A1;BBB;%/A/G;70;75;-; ;A1;BBB;%/A;70;75;-;I would like to find line with '%/A' and put in that line in column 5 and 6 some other value ex: 90 and 99 example output: ;A1;AAA;%/A/B;70;75;-;... (5 Replies)
Discussion started by: vikus
5 Replies

10. Shell Programming and Scripting

sed and awk to find pattern and add priffix

Original File Server1|poweredOn|268401| Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit) Need Output Server1|poweredOn|DR|T1|268401| Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit) Conduction to check find the string "SFCHT1" and "SR" and add prefix has... (4 Replies)
Discussion started by: ranjancom2000
4 Replies
scadm(1M)                                                 System Administration Commands                                                 scadm(1M)

NAME
scadm - administer System Controller (SC) SYNOPSIS
/usr/platform/platform-name/sbin/scadm subcommand [option] [argument...] DESCRIPTION
The scadm utility administers the System Controller (SC). This utility allows the host server to interact with the SC. The scadm utility must be run as root. The interface, output, and location in the directory hierarchy for scadm are uncommitted and might change. platform-name is the name of the platform implementation. Use the uname -i command to identify the platform implementation. See uname(1). The scadm utility has fifteen subcommands. Some subcommands have specific options and arguments associated with them. See SUBCOMMANDS, OPTIONS, OPERANDS, and USAGE. SUBCOMMANDS Subcommands immediately follow the scadm command on the command line, and are separated from the command by a <SPACE>. The following subcommands are supported date Display the SC's time and date The format for the date subcommand is: scadm date download Program the SC's firmware. There are two parts to the firmware, the boot monitor and the main image. By default, The scadm command's download programs the main firmware image. The boot argument selects programming of the boot monitor. The format for the download subcommand is: scadm download [boot] file help Display a list of commands. The format for the help subcommand is: scadm help loghistory Display the most recent entries in the SC event log. The format for the loghistory subcommand is: scadm loghistory resetrsc Reset the SC. There are two types of resets allowed, a hard reset and a soft reset.The hard reset is done by default. The soft reset can be selected by using the -s option. The format for the resetrsc subcommand is: scadm resetrsc [-s] send_event Manually send a text based event. The SC can forward the event to the SC event log. You can configure the -c option to send a critical warning to email, alert to logged in SC users, and syslog. Critical events are logged to sys- log(3C). There is an 80 character limit to the length of the associated text message. The format for the send_event subcommand is: scadm send_event [-c] "message" set Set SC configuration variables to a value. Examples of SC configuration variables include: SC IP address netsc_ipaddr and SC Customer Information sc_customer- info. See the output from the scadm help command for a complete list of SC configuration variables. The format for the set subcommand is: scadm set variable value show Display the current SC configuration variable settings. If no variable is specified, scadm shows all variable set- tings. The format for the show subcommand is: scadm show [variable] shownetwork Display the current network configuration parameters for SC. The format for the shownetwork subcommand is: scadm shownetwork useradd Add user accounts to the SC. The SC supports up to sixteen separate users. The format for the useradd subcommand is: scadm useradd username userdel Delete a user account from SC. The format for the userdel subcommand is: scadm userdel username userpassword Set a password for the user account specified. This password overrides any existing password currently set. There is no verification of the old password before setting the new password. The format for the userpassword subcommand is: scadm userpassword username userperm Set the permission level for the user. The format for the userperm subcommand is: scadm userperm username [aucr] usershow Display details on the specified user account. If a username is not specified, all user accounts are displayed. The format for the usershow subcommand is: scadm usershow username version Display the version numbers of the SC and its components. The format for the version subcommand is: scadm version [-v] OPTIONS
The resetrsc, send_event, and version subcommands have associated options. Options follow subcommands on the command line and are separated from the subcommand by a <SPACE>. The resetrsc subcommand supports the following options: -s Perform a soft reset instead of a hard reset. A hard reset physically resets the SC hardware. The SC software jumps to the boot firmware, simulating a reset, for a soft reset. The send_event subcommand supports the following options: -c Send a critical event. Without the -c, -send_event sends a warning. The version subcommand supports the following options: -v Display a verbose output of version numbers and associated information. OPERANDS
The download, send_event, set, show, useradd, userdel, userperm, usershow, userpassword, and userperm subcommands have associated arguments (operands). If the subcommand has an option, the arguments follow the option on the command line and is separated from the option by a <SPACE>. If the subcommand does not have an option, the arguments follow the subcommand on the command line and are separated from the subcommand by a <SPACE>. If there are more than one arguments, they are separated from each other by a <SPACE>. The download subcommand supports the following arguments: boot Program the boot monitor portion of the flash. The main portion of the flash is programmed without any arguments file Specify file as the path to where the boot or main firmware image resides for download. Examples of file are: /usr/platform/platform_type/lib/image/alommainfw or /usr/platform/platform_type/lib/image/alombootfw The send_event subcommand supports the following arguments: "message" Describe event using the test contained in message. Enclose message in quotation marks. The set subcommand supports the following arguments: variable Set SC configuration variable. value Set SC configuration variable to value. The show subcommand supports the following arguments: variable Display the value of that particular variable. The useradd subcommand supports the following arguments: username Add new SC account username. The userdel subcommand supports the following arguments: username Remove SC account username. The userperm subcommand supports the following arguments: -aucr Set permissions for SC user accounts. If no permissions are specified, all four permissions are disabled and read only access is assigned. The following are the definitions for permissions: a Allow user to administer or change the SC configuration variables u Allow user to use the user commands to modify SC accounts c Allow user to connect to console. r Allow user to reset SC and to power on and off the host. username Change permissions on SC account username. The -usershow subcommand supports the following arguments: username Display information on SC account username . If username is not specified, all accounts are displayed. The userpassword subcommand supports the following arguments: username Set SC password for username. The userperm subcommand supports the following arguments: username Change SC permissions for username. EXAMPLES
Example 1: Displaying the SC's Date and Time The following command displays the SC's date and time. scadm date Example 2: Setting the SC's Configuration Variables The following command sets the SC's configuration variable netsc_ipaddr to 192.168.1.2: scadm set netsc_ipaddr 192.168.1.2 Example 3: Displaying the Current SC's Configuration Settings: The following command displays the current SC configuration settings: scadm show Example 4: Displaying the Current Settings for a Variable The following command displays the current settings for the sys_hostname variable: scadm show sys_hostname Example 5: Sending a Text-Based Critical Event The following command sends a critical event to the SC logs, alerts the current SC users, and sends an event to syslog(3C): scadm send_event -c "The UPS signaled a loss in power" Example 6: Sending an Informational Text-Based Event The following command sends an non-critical informational text based event to the SC event log: scadm send_event "The disk is close to full capacity" Example 7: Adding a User To the SC The following command adds user rscroot to the SC: scadm useradd rscroot Example 8: Deleting a User From the SC The following command deletes user olduser from the SC: scadm userdel olduser Example 9: Displaying User Details The following command displays details of all user accounts: scadm usershow Example 10: Displaying Details for a Specific User The following command displays details of user account rscroot: scadm usershow rscroot Example 11: Setting the User Permission Level The following command sets the full permission level for user rscroot to aucr: scadm userperm rscroot aucr Example 12: Setting the User Permission Level The following command sets only console access for user newuser to c: scadm userperm newuser c Example 13: Setting the User Permission Level The following command sets the permission level for user newuser to read only access: scadm userperm newuser Example 14: Displaying the Current Network Parameters The following command displays the current network configuation parameters for the SC: scadm shownetwork Example 15: Viewing the Loghistory The following command displays the most recent entries in the SC event log: scadm loghistory Example 16: Displaying Verbose Information The following command displays verbose version information on the SC and its components: scadm version -v EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWkvm | +-----------------------------+-----------------------------+ SEE ALSO
uname(1), syslog(3C), attributes(5) SunOS 5.10 27 Feb 2003 scadm(1M)
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy