Sponsored Content
Full Discussion: Replacing a word
Top Forums Shell Programming and Scripting Replacing a word Post 302378534 by jsmithstl on Tuesday 8th of December 2009 05:43:24 AM
Old 12-08-2009
If the line you want to change is the 4th line in each file:

Code:
$ ls
queue_11.txt  queue_12.txt	 queue_13.txt

Code:
$ ls Que*.txt |
> while read FILE
> do
> sed '4s/F/FQ/' ${FILE} > ${FILE}.new
> done

Code:
$ ls
queue_11.txt.new	queue_12.txt.new  queue_13.txt.new
queue_11.txt  queue_12.txt	queue_13.txt

Code:
$ cat Queue_11.txt.new 
reload sec=F
Code=7
reload sec=F
reload sec=FQ
No-load=F1
Reset
NULL
A-cap=LA
reload sec=F

$ cat Queue_12.txt.new
reload sec=F
Code=7
reload sec=F
reload sec=FQ
No-load=F1
Reset
NULL
A-cap=LA
reload sec=F

$ cat Queue_13.txt.new
reload sec=F
Code=7
reload sec=F
reload sec=FQ
No-load=F1
Reset
NULL
A-cap=LA
reload sec=F


Last edited by jsmithstl; 12-08-2009 at 06:46 AM.. Reason: deleted cat *.new to show individual file listings
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing a word with another in shell programming

Hello everyone, I am trying to replace a word by another using shell programming. for that, I can use sed -i 's/second_word/first_word/' file_name but for me,the problem is that I don't know one of the words, It is present in a variable that are created dynamically by... (4 Replies)
Discussion started by: eamani_sun
4 Replies

2. Shell Programming and Scripting

Replacing a word after a matched pattern

Hello, Actually i want to replace the word after a matched pattern. For Ex: lets say that i am reading a file line by line while read line do echo $line # i need to search whether a pattern exists in the file and replace the word after if the pattern exist. # for example :... (1 Reply)
Discussion started by: maxmave
1 Replies

3. Shell Programming and Scripting

Replacing of word

Hi all, I wanted to replace one word with another word pl help me to solve the same. example:- I wanted to replace RXOTX with RXOTRX in a perticuler file with hole. Regards, Ramesh (2 Replies)
Discussion started by: Ramesh Vellanki
2 Replies

4. Shell Programming and Scripting

Replacing word and Incrementing

Hi I'm having difficulty in writing a script with searching a specified word using sed and replaces that word with numbers that is incremented I tried this: #!/bin/sh awk '{ for (i=2010; i<=NF; i++) sed 's/TBA/$i; }' filename.txt > outputfile.txt but it doesn't work. here is my desired... (1 Reply)
Discussion started by: sexyTrojan
1 Replies

5. UNIX for Dummies Questions & Answers

regular expression for replacing the fist word with a last word in line

I have a File with the below contents File1 I have no prior experience in unix. I have just started to work in unix. My experience in unix is 0. My Total It exp is 3 yrs. I need to replace the first word in each line with the last word for example unix have no prior experience in... (2 Replies)
Discussion started by: kri_swami
2 Replies

6. Shell Programming and Scripting

Replacing a word with a buch of lines

Input file: I want to replace "change" with the below lines What is the best way to replace it? (5 Replies)
Discussion started by: gomes1333
5 Replies

7. Shell Programming and Scripting

Replacing first word while extracting

Hello All, I am extracting a part of file. the file looks as follows USING CHARACTER SET UTF8 DEFINE JOB ( DEFINE SCHEMA Flat_File_Schema ( cntnt_id VARCHAR(10) ); DEFINE OPERATOR o_mload TYPE update SCHEMA * ATTRIBUTES ( VARCHAR TdpId = @TdpId (5 Replies)
Discussion started by: nnani
5 Replies

8. UNIX for Dummies Questions & Answers

Replacing word and Capitalize words after

I have an assignment and I am not sure what to do. In Unix, I use PuTTY change the semicolon (;) to a period, and capitalize the first letter of the word immediately after it. I know change command is M-% and "." so only one semicolon is changed but I am not sure how to... (1 Reply)
Discussion started by: kathrut43
1 Replies

9. Shell Programming and Scripting

Replacing a particular word with another word in all the xml's under a particular directory with sed

Hi Folks, Could you please advise what will be the SED command to replace a word in all xml's under a particular directory for example let say I rite now at the following below location $ cd /ter/rap/config now under config directory there will be lots of xml file , now my objective is to... (1 Reply)
Discussion started by: punpun66
1 Replies

10. Shell Programming and Scripting

Replacing the first word if the word three match

Dear ALL, I have sample file : IDcentos-forum,bash,linuxCentOS,GNome IEfedora-milis,cli,linuxRedhat,KDE IRfreebsd-milis,aix,unixbsd,pyton required output: centos,bash,linuxCentOS,GNome fedora,cli,linuxRedhat,KDE freebsd,aix,unixbsd,pyton Can you help me pls.. (1 Reply)
Discussion started by: gnulyn
1 Replies
GLFRONTFACE(3G) 														   GLFRONTFACE(3G)

NAME
glFrontFace - define front- and back-facing polygons C SPECIFICATION
void glFrontFace( GLenum mode ) PARAMETERS
mode Specifies the orientation of front-facing polygons. GL_CW and GL_CCW are accepted. The initial value is GL_CCW. DESCRIPTION
In a scene composed entirely of opaque closed surfaces, back-facing polygons are never visible. Eliminating these invisible polygons has the obvious benefit of speeding up the rendering of the image. To enable and disable elimination of back-facing polygons, call glEnable and glDisable with argument GL_CULL_FACE. The projection of a polygon to window coordinates is said to have clockwise winding if an imaginary object following the path from its first vertex, its second vertex, and so on, to its last vertex, and finally back to its first vertex, moves in a clockwise direction about the interior of the polygon. The polygon's winding is said to be counterclockwise if the imaginary object following the same path moves in a counterclockwise direction about the interior of the polygon. glFrontFace specifies whether polygons with clockwise winding in window coordinates, or counterclockwise winding in window coordinates, are taken to be front-facing. Passing GL_CCW to mode selects counterclock- wise polygons as front-facing; GL_CW selects clockwise polygons as front-facing. By default, counterclockwise polygons are taken to be front-facing. ERRORS
GL_INVALID_ENUM is generated if mode is not an accepted value. GL_INVALID_OPERATION is generated if glFrontFace is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_FRONT_FACE SEE ALSO
glCullFace(3G), glLightModel(3G) GLFRONTFACE(3G)
All times are GMT -4. The time now is 01:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy