Sponsored Content
Top Forums Shell Programming and Scripting Need to add a comment line in a text file Post 84220 by orakhan on Thursday 22nd of September 2005 08:23:17 PM
Old 09-22-2005
No Updates Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add text to file at a certain line

I am trying to add a line of text just before the last line in a file. For example, if the last line of a file is "exit 0", I need to add a line of text just before that. Any ideas how I might do that? Thanks (5 Replies)
Discussion started by: TheCrunge
5 Replies

2. Shell Programming and Scripting

comment text in a file

Hello folks Hope all are fine, I have query need suggestion, if these lines two lines are already commeted no need to do anything, one more thing order of alpha, gama may be different. I have a two lines in a file data.txt %checksum alpha gama beta penta hexa I want to do... (8 Replies)
Discussion started by: learnbash
8 Replies

3. UNIX for Dummies Questions & Answers

how to replace a text of line with a comment line

I want to replace this line : "test compare visible] true" and make it "#test compare visible] true". How can I do it ? And it should be checked in many sub folder files also. (6 Replies)
Discussion started by: manoj.b
6 Replies

4. Shell Programming and Scripting

Add ; to every line in text file

Please help to add ; to every line in a text file i Have tired sed 's/$/ ; /g' > /tmp/drop_tables.sql but not working :( Thanks (2 Replies)
Discussion started by: bluebird5m
2 Replies

5. Shell Programming and Scripting

sed add after line x new text from file

I've been playing with sed, trying to get it to insert the contents of somefile.txt after line 13 on anotherfile.txt. I tried searching for a line with regex and attempting to insert something on the next line with: find ./anotherfile.txt -type f -exec sed -i -e '/^dog/cat/' {} \; but it... (2 Replies)
Discussion started by: unclecameron
2 Replies

6. Shell Programming and Scripting

add line and remove comment in some script

Hi, i need some help. i am not sure about my idea. I have a script directory under my home directory,which has a lot of scripts in it. These are some names of the scripts in /axxhome/prdv/script aly300.sh axt300.sh arv300.sh clp300.sh ctth300.sh aly400.sh axt400.sh arv400.sh... (6 Replies)
Discussion started by: debu000
6 Replies

7. Shell Programming and Scripting

how to add text into the last line of text file

I need help with insert text to the last line of text file with echo command I know can do something like echo "i4\n$logtext\n.\nwq" | ex -s $file can insert to first line, but how can i change this code in order to insert to the last line of text file? please help, thank you :( (2 Replies)
Discussion started by: gavin_L
2 Replies

8. Shell Programming and Scripting

How to comment a specific line of a file?

Hi, I need to comment out (insert # in the front of a line) a line that has entry Defaults requiretty using command-line as I need to do this on hundreds of servers. From Defaults requiretty To #Defaults requiretty I tried something like below but no luck: Please advise,... (3 Replies)
Discussion started by: prvnrk
3 Replies

9. Shell Programming and Scripting

Add comment on last line if found match

Hi All, totally new on it , normally use it for just 1 line. i'm looking for help. i'm have 2 file. file 1 : -------------------------------------------------- c12 c1 c3 -------------------------------------------------- file 2: other content ... (10 Replies)
Discussion started by: kttan
10 Replies

10. UNIX for Beginners Questions & Answers

How to comment a specific line of a file in Solaris 10?

Hi Folks, sed -i '3s/^/#/' abc.txt is commenting the line number 3 in LINUX Not Working in Solaris 10 or higher sed -i sed -i '3s/^/#/' abc.txt sed: illegal option -- i i have a file as below cat abc.txt bc vdv shhsd cdc skdk Please advise (15 Replies)
Discussion started by: abhaydas
15 Replies
ddi_prop_update(9F)					   Kernel Functions for Drivers 				       ddi_prop_update(9F)

NAME
ddi_prop_update, ddi_prop_update_int_array, ddi_prop_update_int, ddi_prop_update_string_array, ddi_prop_update_int64, ddi_prop_update_int64_array, ddi_prop_update_string, ddi_prop_update_byte_array - update properties SYNOPSIS
#include <sys/ddi.h> #include <sys/sunddi.h> int ddi_prop_update_int_array(dev_t dev, dev_info_t *dip, char *name, int *data, uint_t nelements); int ddi_prop_update_int(dev_t dev, dev_info_t *dip, char *name, int data); int ddi_prop_update_int64_array(dev_t dev, dev_info_t *dip, char *name, int64_t *data, uint_t nelements); int ddi_prop_update_int64(dev_t dev, dev_info_t *dip, char *name, int64_t data); int ddi_prop_update_string_array(dev_t dev, dev_info_t *dip, char *name, char **data, uint_t nelements); int ddi_prop_update_string(dev_t dev, dev_info_t *dip, char *name, char *data); int ddi_prop_update_byte_array(dev_t dev, dev_info_t *dip, char *name, uchar_t *data, uint_t nelements); PARAMETERS
dev Device number associated with the device. dip Pointer to the device info node of device whose property list should be updated. name String containing the name of the property to be updated. nelements The number of elements contained in the memory pointed at by data. ddi_prop_update_int_array() data A pointer an integer array with which to update the property. ddi_prop_update_int() data An integer value with which to update the property. ddi_prop_update_int64_array() data An pointer to a 64-bit integer array with which to update the property. ddi_prop_update_int64() data A 64-bit integer value with which to update the property. ddi_prop_update_string_array() data A pointer to a string array with which to update the property. The array of strings is formatted as an array of pointers to NULL terminated strings, much like the argv argument to execve(2). ddi_prop_update_string() data A pointer to a string value with which to update the property. ddi_prop_update_byte_array() data A pointer to a byte array with which to update the property. INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). DESCRIPTION
The property update routines search for and, if found, modify the value of a given property. Properties are searched for based on the dip, name, dev, and the type of the data (integer, string, or byte). The driver software properties list is searched. If the property is found, it is updated with the supplied value. If the property is not found on this list, a new property is created with the value supplied. For example, if a driver attempts to update the "foo" property, a property named "foo" is searched for on the driver's software property list. If "foo" is found, the value is updated. If "foo" is not found, a new property named "foo" is created on the driver's software property list with the supplied value even if a "foo" property exists on another property list (such as a PROM property list). Every property value has a data type associated with it: byte, integer, or string. A property should be updated using a function with the same corresponding data type as the property value. For example, an integer property must be updated using either ddi_prop_update_int_array() or ddi_prop_update_int(). For a 64-bit integer, you must use ddi_prop_update_int64_array() or ddi_prop_update_int64(). Attempts to update a property with a function that does not correspond to the property data type that was used to create it results in an undefined state. Usually, the dev argument should be set to the actual device number that this property is associated with. If the property is not associ- ated with any particular dev, then the argument dev should be set to DDI_DEV_T_NONE. This property will then match a look up request (see ddi_prop_lookup(9F)) with the match_dev argument set to DDI_DEV_T_ANY. If no dev is available for the device (for example during attach(9E) time), one can be created using makedevice(9F) with a major number of DDI_MAJOR_T_UNKNOWN. The update routines will then generate the cor- rect dev when creating or updating the property. name must always be set to the name of the property being updated. For the routines ddi_prop_update_int_array(), ddi_prop_lookup_int64_array(), ddi_prop_update_string_array(), ddi_prop_update_string(), and ddi_prop_update_byte_array(), data is a pointer which points to memory containing the value of the property. In each case *data points to a different type of property value. See the individual descriptions of the routines below for details concerning the different values. nele- ments is an unsigned integer which contains the number of integer, string, or byte elements accounted for in the memory pointed at by *data. For the routines ddi_prop_update_int() and ddi_prop_update_int64(), data is the new value of the property. ddi_prop_update_int_array() Updates or creates an array of integer property values. An array of integers is defined to be nelements of 4 byte long integer elements. data must be a pointer to an integer array with which to update the property. ddi_prop_update_int() Update or creates a single integer value of a property. data must be an integer value with which to update the property. ddi_prop_update_int64_array() Updates or creates an array of 64-bit integer property values. An array of integers is defined to be nelements of int64_t integer elements. data must be a pointer to a 64-bit integer array with which to update the property. ddi_prop_update_int64() Updates or creates a single 64-bit integer value of a property. data must be an int64_t value with which to update the property. ddi_prop_update_string_array() Updates or creates a property that is an array of strings. data must be a pointer to a string array with which to update the property. The array of strings is formatted as an array of pointers to NULLterminated strings, much like the argv argument to execve(2). ddi_prop_update_string() Updates or creates a property that is a single string value. data must be a pointer to a string with which to update the property. ddi_prop_update_byte_array() Updates or creates a property that is an array of bytes. data should be a pointer to a byte array with which to update the property. The property update routines may block to allocate memory needed to hold the value of the property. RETURN VALUES
All of the property update routines return: DDI_PROP_SUCCESS On success. DDI_PROP_INVAL_ARG If an attempt is made to update a property with name set to NULL or name set to the null string. DDI_PROP_CANNOT_ENCODE If the bytes of the property cannot be encoded. CONTEXT
These functions can only be called from user or kernel context. EXAMPLES
Example 1 Updating Properties The following example demonstrates the use of ddi_prop_update_int_array(). int options[4]; /* * Create the "options" integer array with * our default values for these parameters */ options[0] = XX_OPTIONS0; options[1] = XX_OPTIONS1; options[2] = XX_OPTIONS2; options[3] = XX_OPTIONS3; i = ddi_prop_update_int_array(xx_dev, xx_dip, "options", &options, sizeof (options) / sizeof (int)); SEE ALSO
execve(2), attach(9E), ddi_prop_lookup(9F), ddi_prop_remove(9F), makedevice(9F) Writing Device Drivers SunOS 5.11 28 Aug 2001 ddi_prop_update(9F)
All times are GMT -4. The time now is 02:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy