Top Forums Shell Programming and Scripting [sed]: Substitute a string with a multiline value Post 302978697 by dae on Tuesday 2nd of August 2016 04:50:39 PM
rdrtx1 & RudiC, thanks a lot for your answers !

RudiC, you mentioned in your answer awk would be useful to carry out that kind of operation.

If you have few minutes, would you like to share the syntax ?
Test Your Knowledge in Computers #486
Difficulty: Medium
After a computer program is loaded and setup, the operating system begins executing the instructions at the program's end point in reverse byte-execution mode.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete multiline string from file using sed.

Hi, I have file which has the following content... GOOD MORNING **********WARNING********** when it kicks from the kickstart, sshd daemon should start at last. (WHEN KICKING ITSELF, NOT AFTER KICKING). /etc/rc3.d/S55sshd ( run level specification for sshd is 55, now I would want to... (4 Replies)
Discussion started by: skmdu
4 Replies

2. Shell Programming and Scripting

Multiline pattern search using sed or awk

Hi friends, Could you please help me to resolve the below issue. Input file :- <Node> <username>abc</username> <password>ABC</password> <Node> <Node> <username>xyz</username> <password>XYZ</password> <Node> <Node> <username>mnp</username> ... (3 Replies)
Discussion started by: haiksuresh
3 Replies

3. UNIX for Dummies Questions & Answers

Reading one line from a multiline string

Hi , I have a string which is of multiple line,I have to split the string by reading one line in each iteration and keep it in a string.I am keeping all the file names in side as string returned by the ls command ,I am stocked at the point of spliting the string to segragate each file. ... (4 Replies)
Discussion started by: Deekay.p
4 Replies

4. Shell Programming and Scripting

sed doubt - search and substitute string from variable.

hi, trying to learn more abt sed :( i want to substitute a variable(a) with other variable(b) appended. Read.txt contains: home/test2/abc home/test/root1 input.txt contains: make test "home/test1/none"version="1.3" wt's wrong test "home/test2/abc"version="1.0" make save... (9 Replies)
Discussion started by: dragon.1431
9 Replies

5. UNIX for Dummies Questions & Answers

sed multiline pattern match

How can I write a script that takes a cisco config file and outputs every occurrence of two, or more, pattern matches through the whole config file? For example, out of a config file, i want to print out every line with interface, description and ip address through the whole file, and disregard... (3 Replies)
Discussion started by: knownasthatguy
3 Replies

6. Shell Programming and Scripting

{bash scripting} Multiline initialisation of string variable

Hello, The task is quite simple. I need to initialise а string variable and assign to it a very long value. For the reason of readability I want to devide this long value into equal parts and place each part at a separate line. For instance, I have - ... (1 Reply)
Discussion started by: Pretoria
1 Replies

7. UNIX for Dummies Questions & Answers

Need Multiline sed help!!

Hey everyone, I'm new to sed and I need to create a script for inserting one line of code at the beginning of every method in a Xcode project (over 6,000 methods). Each method Structure is (+ or -) (Various declarations-- could span multiple lines) ({) I've tried for days, any guidance would be... (2 Replies)
Discussion started by: jimmyz
2 Replies

8. Shell Programming and Scripting

Multiline sed

Hi guys, I am fairly comfortable with using the sed command if the string to be replaced is all on a single line. I was wondering is it possible to use sed command in a multiline way ? Say for example I have the below string on 2 different lines: { "key": "brandNameA", ... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies

9. Shell Programming and Scripting

sed multiline problem

I'm trying to replicate the sed output on p.108 of Sed&Awk,by Doughery & Robbins, 2nd edition. I'm on a Windows 10 Surface Pro, running Cygwin for 64-bit versions of Windows. Input text saved in text file called data_p108.txt: Consult Section 3.1 in the Owner and Operator Guide for a... (9 Replies)
Discussion started by: prooney
9 Replies
PURITY(6)							   Games Manual 							 PURITY(6)

purity - a general purpose purity test SYNOPSIS
/usr/games/purity [ flags ] [ testname ] DESCRIPTION
Purity is an interactive purity test program with a simple, user interface and datafile format. For each test, questions are printed to the your terminal, and you are prompted for an answer to the current question. At a prompt, these are your choices: y Answer "yes" to the question. n Answer "no" to the question. b Backup one question, if you answered it incorrectly, or someone is watching you take the test, and you don't (or do) want to admit a different answer. r Redraw the current question. q Quit the test, and print the current score. ? Print a help screen for the current prompt. k Kill a section of the test. This skips all the questions of the test until the next subject heading. a Toggle answer mode between real answers and obfuscated answers. Real answers print "yes" and "no", while obfuscated answers are "Maybe" and "maybe". Obfuscated answers are preferred if you are shy, and don't want people to be able to read your answers over your shoulder as you take the test. d Toggle dERanGe output. s Print your current score on the test you are taking. l Toggle score logging. At the end of the test, your score is printed out. For most purity tests, lower scores denote more "experience" of the test material. FLAGS
These are the command line flags for the test. -a Show real answers (i.e. "yes" and "no") instead of obfuscated ones (i.e. "Maybe" and "maybe") as you answer the questions. -d PrINt THe tESt in DerANgeD pRInT. -f Take the test in fast mode. Only the questions are printed, and not any other text blocks, like the introdution, subject headers, and the conclusion. -l Take the test without having your score logged. -p Print the test without prompting for answers. This is useful for making hard copies of the tests without having to edit out the prompts by hand. -r Decrypt the test using the Rot 13 algorithm. This is done as a form of "protection", such that if you read a rot13 test and it offends you, it's your own fault. -z zoom through more prompts in large text blocks. The default is to prompt the user for more when a screenful of text has been printed without any user input. DATAFILE FORMAT
The format of the datafiles is a very simple format, intended such that new tests can quickly and easily be converted to run with the test. There are four types of text in a purity test datafile. Each type is contained in a bracket type of punctuation. The definitions are as follows: the styles of text blocks are: { plain text block } [ subject header ] ( test question ) and < conclusion > Plain text blocks are printed out character for character. Subject headers are preceded by their subject numbers, starting at 1, and then printed as text blocks. Questions are preceded by their numbers, and then prompt the user to answer the question, keeping track of the user's current score. Conclusions first calculate and print the user's score for the test, then print out the conclusion as a text block. If you wish to include any of the various bracket punctuation in your text, the backslash ("") character will escape the next character. To print a question with parentheses, you would use the following format: (have you ever written a purity test (like this one)?) the output would be this: 1. have you ever written a purity test (like this one)? and then it would have asked the user for her/his answer. For a generic datafile, use the "sample" datafile for the test. FILES
/var/games/purity.scores the score logfile /usr/share/games/purity/* test data files AUTHOR
Eric Lechner, 18 December 1989 PURITY(6)

Featured Tech Videos

All times are GMT -4. The time now is 08:32 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy