Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Changing array of data by sed Post 303044796 by RudiC on Wednesday 4th of March 2020 05:37:49 AM
Old 03-04-2020
First thing to do is: get rid of syntax errors in your code.


For your problem, try
Code:
tac file | awk '/<type>5/ {T5 = 1} /<alarmsend/ && T5 {sub (/yes/, "no"); T5 = 0} 1' | tac
<alarmsend>no</alarmsend>
<server>Hajk</server>
<type>5</type>
<alarmsend>yes</alarmsend>
<server>Hajk</server>
<type>1</type>
<alarmsend>yes</alarmsend>
<server>Hajk</server>
<type>3</type>
<alarmsend>no</alarmsend>
<server>Hajk</server>
<type>5</type>

This User Gave Thanks to RudiC 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
fsck.ocfs2(8)							OCFS2 Manual Pages						     fsck.ocfs2(8)

NAME
fsck.ocfs2 - Check an OCFS2 file system. SYNOPSIS
fsck.ocfs2 [ -pafFGnuvVy ] [ -b superblock block ] [ -B block size ] device DESCRIPTION
fsck.ocfs2 is used to check an OCFS2 file system. device is the file where the file system is stored (e.g. /dev/sda1). It will almost always be a device file but a regular file will work as well. OPTIONS
-a This option does the same thing as the -p option. It is provided for backwards compatibility only: it is suggested that people use the -p option whenever possible. -b superblock block Normally, fsck.ocfs2 will read the superblock from the first block of the device. This option specifies an alternate block that the superblock should be read from. (Use -r instead of this option.) -B blocksize The block size, specified in bytes, can range from 512 to 4096. A value of 0, the default, is used to indicate that the blocksize should be automatically detected. -D Optimize directories in filesystem. This option causes fsck.ocfs2 to coalesce the directory entries in order to improve the filesys- tem performance. -f Force checking even if the file system is clean. -F By default fsck.ocfs2 will check with the cluster services to ensure that the volume is not in-use (mounted) on any node in the cluster before proceeding. -F skips this check and should only be used when it can be guaranteed that the volume is not mounted on any node in the cluster. WARNING: If the cluster check is disabled and the volume is mounted on one or more nodes, file system cor- ruption is very likely. If unsure, do not use this option. -G Usually fsck.ocfs2 will silently assume inodes whose generation number does not match the generation number of the super block are unused inodes. This option causes fsck.ocfs2 to ask the user if these inodes should in fact be marked unused. -n Give the 'no' answer to all questions that fsck will ask. This guarantees that the file system will not be modified and the device will be opened read-only. The output of fsck.ocfs2 with this option can be redirected to produce a record of a file system's faults. -p Automatically repair ("preen") the file system. This option will cause fsck.ocfs2 to automatically fix any problem that can be safely corrected without human intervention. If there are problems that require intervention, the descriptions will be printed and fsck.ocfs2 will exit with the value 4 logically or'd into the exit code. (See the EXIT CODE section.) This option is normally used by the system's boot scripts. -r backup-number mkfs.ocfs2 makes upto 6 backup copies of the superblock at offsets 1G, 4G, 16G, 64G, 256G and 1T depending on the size of the vol- ume. Use this option to specify the backup, 1 thru 6, to use to recover the superblock. -y Give the 'yes' answer to all questions that fsck will ask. This will repair all faults that fsck.ocfs2 finds but will not give the operator a chance to intervene if fsck.ocfs2 decides that it wants to drastically repair the file system. -v This option causes fsck.ocfs2 to produce a very large amount of debugging output. -V Print version information and exit. EXIT CODE
The exit code returned by fsck.ocfs2 is the sum of the following conditions: 0 - No errors 1 - File system errors corrected 2 - File system errors corrected, system should be rebooted 4 - File system errors left uncorrected 8 - Operational error 16 - Usage or syntax error 32 - fsck.ocfs2 canceled by user request 128 - Shared library error SEE ALSO
mkfs.ocfs2(8) debugfs.ocfs2(8) tunefs.ocfs2(8) mounted.ocfs2(8) ocfs2console(8) o2cb(7) AUTHORS
Oracle Corporation. This man page entry derives some text, especially the exit code summary, from e2fsck(8) by Theodore Y. Ts'o <tytso@mit.edu>. COPYRIGHT
Copyright (C) 2004, 2010 Oracle. All rights reserved. Version 1.6.4 September 2010 fsck.ocfs2(8)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy