Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Changing array of data by sed Post 303044845 by nezabudka on Thursday 5th of March 2020 04:44:51 AM
Old 03-05-2020
Code:
sed 'N;N;/5/ s/yes/no/' file
sed '/^<alarmsend/{N;N;\%5</type>$% s/yes/no/}' file

--- Post updated at 13:44 ---

If you complicate the task as much as possible
Code:
sed -r '/^<alarm/ {:1;N;\%</type>$%!b1}; s%^(<alarmsend>)yes(.*5</type>$)%\1no\2%' file

These 2 Users Gave Thanks to nezabudka For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing text with sed?

Hi everyone, Having trouble with sed. I searched the board and found some stuff, but still unclear. I have a file named "userfile" which stores the users info in this form: email:username:password: I want the user to be able to change their password. i tried with sed s/oldpass/newpass/g... (2 Replies)
Discussion started by: primal
2 Replies

2. Shell Programming and Scripting

Changing Special Characters Using Sed

Hi. Does anyone know how to use the sed command to change the special border characters on this .per file. I have to edit about 80 .per files. I need a sed script to change the below 3 and A characters. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Test Islands, Office of Public Health -- WIC... (4 Replies)
Discussion started by: cstovall
4 Replies

3. UNIX for Dummies Questions & Answers

Changing the order using sed

I have a text "abc def ghi" and I want to get it as "def abc ghi" I am using this echo "abc def ghi" | sed 's/\(*\)\(*\)/\2\1/' But I am not able to get the output, could anyone help me. Thanks (9 Replies)
Discussion started by: venu_nbk
9 Replies

4. Shell Programming and Scripting

sed and changing the file itself

hello I have this: sed -e "s/install_location=....../g" -e "s/hostname=....../g" -e "s/server_name=....../y" input.txt it will display on the screen what have changed. however I want to change file input.txt. Any idea other than doing redirection (>) thx (2 Replies)
Discussion started by: melanie_pfefer
2 Replies

5. UNIX for Dummies Questions & Answers

changing data into matrix form

Hi, I have a file whose structure is like this 7 7 1 2 3 4 5 1 3 4 8 6 1 4 5 6 0 2 6 8 3 8 2 5 7 8 0 5 7 9 4 1 3 8 0 2 2 3 5 6 8 basically first two row tell the number of rows and column but the data following them are not arranged in that format. now i want to create another... (1 Reply)
Discussion started by: g0600014
1 Replies

6. Shell Programming and Scripting

changing c comments to c++ style with sed

Hi everyone, I've got a problem with converting C comments ( /* */ ) into C++ style ( // ) in some source file with sed. So far I've dealt with comments on one line, but I don't know how to convert when it is over multiple lines ... So I already have something like this: comments.sed ... (8 Replies)
Discussion started by: kolage
8 Replies

7. UNIX for Dummies Questions & Answers

Changing Text with sed or awk

I'm changing some html code on multiple web pages and I need to match particular phrases but keep some text within each phrase. E.G. I need to change this line: <DIV id="heading">Description:</DIV> into <span class="hlred">Description:</span><br /> The text "Description:" may... (2 Replies)
Discussion started by: hal8000
2 Replies

8. Shell Programming and Scripting

sed/awk changing values

Can somebody help me out and provide me with a SED or AWK solution that converts TO_DATE CLAUSE -> TIMESTAMP I need to keep the PARTION value (HISTORY_20110417) and DATE/TIME value (2011-04-18 00:00:00) the same for every line PARTITION HISTORY_20110417 VALUES LESS THAN (TO_DATE('... (3 Replies)
Discussion started by: BeefStu
3 Replies

9. UNIX for Dummies Questions & Answers

Changing data format from column into array

I have a file containing numbers in a column like: 10.5 16.3 15.7 2.3 46.8 3.3 . . . and I was wondering if there was a way to make it show up in an array form like: 10.5 2.3 16.3 46.8 15.7 3.3 Let's say I want to make a new column every 100 values. How can I do... (8 Replies)
Discussion started by: ShiGua
8 Replies

10. Shell Programming and Scripting

Changing time-stamp with sed

Hi ! I try to change a time-stamp hh:mm:ss allways to full ten-minutes. example: 12:51:03 to 12:50:03 sed 's/::/:{0-5}0:/g' file.txt but it will not work propperly, because the minute-decade will be replaced with the bracket-term {0-5}. Can someone please give me a hint? Thanks in... (6 Replies)
Discussion started by: IMPe
6 Replies
sad(7)							 Miscellaneous Information Manual						    sad(7)

NAME
sad - STREAMS Administrative Driver SYNOPSIS
... DESCRIPTION
The driver provides an interface to the facility using the function. As an interface, the driver enables administrative tasks to be per- formed on STREAMS modules and drivers. By specifying the command parameter to the function, an administrator can configure information for a device, get information on a device, or check a list of modules. fildes is a file descriptor obtained by opening using command specifies the administrative function to be performed. arg points to a data structure. If command is or arg points to a struct of type If command is arg points to a struct of type Security Restrictions The is restricted to superusers or users with the privilege. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. ioctl Commands The commands used to perform administrative functions on a STREAMS module or driver are specified by the following commands: Allows you to configure information for a device. The arg parameter points to a structure (defined in the header file), whose members are as follows: Allows you to specify the type of configuration to perform. This field can have the following values: Configures all minor devices. Configures a range of minor devices. Configures a single minor device. Clears the previous settings. Specify only the and fields when using this command. If a previous entry specified set the field to 0 (zero). If a previous entry was specified as set the field to the lowest minor device number in the range. Specifies the major device number. Specifies the minor device number. Specifies the range of minor devices. Specifies the number of modules to push. This number must be no more than which is defined in Additionally, this number must not exceed Specifies, in order, the array of modules to push. Lets you use the driver to obtain configuration information for a device by setting the and fields of the structure (see the command) to the major and minor device numbers of the device being queried. arg should point to a struct of type Upon successful completion, the structure contains all of the information used to configure the device. Values of 0 (zero) will appear in any unused entry in the module list. Enables you to check a list of modules. For example, you can determine if a specific module has been installed. The arg parameter points to a structure (defined in the header file), whose members are as follows: Specifies the number of entries you have allocated in an array. Points to the array of module names. The structure (also in the header file) is as follows: where specifies the array of module names. If the array is valid, the command returns a value of 0 (zero). If the array contains an invalid module name, the com- mand returns a value of 1. Upon failure, the command returns a value of -1. Notes As a STREAMS driver, also supports the normal STREAMS In this form, specify the field in the structure to either or The field points to the structure (see the command in the section). Refer to the streamio(7) reference page for further details. RETURN VALUE
Unless specified otherwise, upon successful completion, the commands return a value of 0 (zero). Otherwise, a value of -1 is returned. ERRORS
If any of the following conditions occur, the commands return the corresponding value: The specified major/minor device number pair has already been configured. The arg parameter points outside the allocated address space. The major device number is invalid, the number of modules is invalid, or the list of module names is invalid. The device is not configured for This value is returned from a command. A internal data structure cannot be allocated. The major device does not represent a STREAMS driver. The field is less than the field when the command is or the minor device specified in a command does not exist. Only a superuser or user with privilege is allowed to execute the The arg parameter points outside the allocated address space. The major device number is invalid. The device is not configured for The major device does not represent a STREAMS driver. The arg parameter points outside the allocated address space. The list of module names is invalid. SEE ALSO
autopush(1M), ioctl(2), open(2), privileges(5), streamio(7). sad(7)
All times are GMT -4. The time now is 09:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy