Sponsored Content
Top Forums Shell Programming and Scripting Replacing specific lines with another lines Post 302643325 by MILAN KUMAR on Saturday 19th of May 2012 05:13:11 AM
Old 05-19-2012
Replacing specific lines with another lines

Hi,

I have a file with many lines,
then i have following list of lines(line number 5,12,19,5,and 28) i need to replace these lines of a file with another lines as shown below these text
contains special charecter like= (/:;){}[]

Code:
Line_number  Text to replace with
5                  abc xyg ;, : def
12                 replace with this ;, : def
19                 test abc io ; /kjlkj;
5                   thisis sis nok ioijlk; ';
28                 abc xyg ;, : def

Can some one give me a quick solution.

Moderator's Comments:
Mod Comment edit by bakunin: please use [code]...[/code] tags when posting code or output. Thank you.

Last edited by bakunin; 05-19-2012 at 06:45 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing specific lines in a file

Hi there I have a file which has the lines # Serial number for hostid EXP_SERIAL_="" These lines could be anywhere in the file as far as line numbers go, I would like replace these two lines with # Serial number for hostid $var1 EXP_SERIAL_$var1="$var2" Is there a quick and simple... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

2. Shell Programming and Scripting

replacing new lines in all files of a directory containing old lines

Hi all, I am trying to replace a few lines with other lines of all files in a directory which contain those few lines. say - there are some 10 files in a dir having the same 4 lines as 1.txt at the starting 1.txt line 1 line 2 line 3 line 4 ....................................... (1 Reply)
Discussion started by: rooster005
1 Replies

3. Shell Programming and Scripting

Printing all lines before a specific string and a custom message 2 lines after

Hello all, I need to print all the lines before a specific string and print a custom message 2 lines after that. So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message. My code thus far is:... (4 Replies)
Discussion started by: SEinT
4 Replies

4. Shell Programming and Scripting

Help in replacing two blank lines with two lines of diff data

Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script... I used sed to search a line and insert two blank lines after the searchd line using the following sed command. sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
Discussion started by: arjun_arippa
4 Replies

5. UNIX for Dummies Questions & Answers

Finding lines with a regular expression, replacing them with blank lines

So the tag for this forum says all newbies welcome... All I want to do is go through my file and find lines which contain a given string of characters then replace these with a blank line. I really tried to find a simple command to do this but failed. Here's what I did come up with though: ... (2 Replies)
Discussion started by: Golpette
2 Replies

6. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

7. UNIX for Dummies Questions & Answers

Extract lines with specific words with addition 2 lines before and after

Dear all, Greetings. I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed. For example, the input file is: 1 ak1 abc1.0 1 ak2 abc1.0 1 ak3 abc1.0 1 ak4 abc1.0 1 ak5 abc1.1 1 ak6 abc1.1 1 ak7... (7 Replies)
Discussion started by: Amanda Low
7 Replies

8. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum

Hi friends, This is sed & awk type question. It is slightly different from my previous question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the... (4 Replies)
Discussion started by: kaaliakahn
4 Replies

9. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

10. UNIX for Beginners Questions & Answers

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
ECACCESS-EVENT-GRANT(1p)				User Contributed Perl Documentation				  ECACCESS-EVENT-GRANT(1p)

NAME
ecaccess-event-grant - Grant usage of an ECaccess Event SYNOPSIS
ecaccess-event-grant -version|-help|-manual ecaccess-event-grant [-debug] [-subscribe] [-notify] event-id user-list DESCRIPTION
Allow managing the Event permissions for a list of user(s). The permissions can be either subscribe, notify, both or none. In order to remove permissions to an Event for a list of users use this command with no -subscribe and -notify options. ARGUMENTS
event-id The identifier of the Event to grant. user-list The user(s) to give/remove the permissions. Multiple users should be separated by a column (e.g. abc,def). OPTIONS
-subscribe The user(s) specified in the user-list will be allowed to subscribe to the event-id (e.g. with the -eventIds option of the ecaccess-job-submit command). -notify The user(s) specified in the user-list will be allowed to send notifications to the event-id (e.g. with the ecaccess-event-send command). -version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-event-grant -subscribe 167 abc,def,jhi Allow the users abc, def and jhi to subscribe to this Event. ecaccess-event-grant 167 jkl Remove all rights to the Event for the user jkl. SEE ALSO
ecaccess-event-clear, ecaccess-event-delete, ecaccess-event-send, ecaccess-event-list, ecaccess-event-create and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-EVENT-GRANT(1p)
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy