Hi,
I need a sed line that will find all lines that contain "<int key="NSWindowStyleMask">" and then replace the entire line (not just that one string) with "<int key="NSWindowStyleMask">8223</int>". It doesn't necessarily have to use sed as long as it gets the job done :)
Thanks (9 Replies)
I've got a file full of numbers, example:
cat test.file
60835287
0
51758036
40242437
0
32737144
0
24179513
0
4131489957
I want to replace those numbers (4 Replies)
I want to use sed to check if a short line is contained in the line after it, and if it is, to delete the short one. In other words, the input is...
This is a
This is a line
... and I want it to give me...
This is a line
Here's what I've tried so far: s/\(^.*\)\n\(\1.*$\)/\2/
Also,... (7 Replies)
Hello,
I have 8 lines containing these unique words in both files
645147468537
673962863160
673962864957
691717701950
707917019907
790085591726
792975507744
852174812753
file.dat.orig (has 1000 lines) and file.dat(has only 8 lines)
I want to replace those lines in file.dat.orig by... (1 Reply)
Hi everybody,
I am a newbie in shell scripting and I'm trying to write a script which reads lines from a file, searching some of this lines to change a specified number. I want to replace the line for another in the file.
I have to replace multiples lines, so I have a for. Now I am trying with... (1 Reply)
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Hi, I am looking at modifiying a file but getting a bit lost with what i am trying to do.
I have the following file i need to alter. I want to search a list of files for the DEVSERIAL "0007862454" part but only the numbers. I then need to replace the line under DRIVES with the correct drive... (7 Replies)
Literally cannot get this one, guys. Single line replacement is simple, but I am not understanding the correct syntax for including a new line feed into the substitution part.
Here's what I got. (Cannot use perl)
#!/bin/sh
set -f
#Start Perms
export HOME=/home/test_user
# End Perms... (6 Replies)
I need to replace the (*) in the fist of a list with numbers using sed for example >
this file contain a list
* linux
* computers
* labs
* questions
to >>>>
this file contain a list
1. linux
2. computers
3. labs
4. questions (7 Replies)
Hello,
I'm here again asking for your precious help.
I'm writing some code to convert csv files to html.
I want to highlight header and also I want to have rows with alternate colors.
So far this is my work###Let's format first line only with some color
cat $fileIN".tmp1" | sed '1... (7 Replies)
Discussion started by: emare
7 Replies
LEARN ABOUT NETBSD
qsubst
QSUBST(1) BSD General Commands Manual QSUBST(1)NAME
qsubst -- query-replace strings in files
SYNOPSIS
qsubst str1 str2 [flags] file [file [...]]
DESCRIPTION
qsubst reads its options (see below) to get a list of files. For each file on this list, it then replaces str1 with str2 wherever possible
in that file, depending on user input (see below). The result is written back onto the original file.
For each potential substitution found, the user is prompted with a few lines before and after the line containing the string to be substi-
tuted. The string itself is displayed using the terminal's standout mode, if any. Then one character is read from the terminal. This is
then interpreted as follows (this is designed to be like Emacs' query-replace-string):
space Replace this occurrence and go on to the next one.
. Replace this occurrence and don't change any more in this file (i.e., go on to the next file).
, Tentatively replace this occurrence. The lines as they would look if the substitution were made are printed out. Then another
character is read and it is used to decide the result as if the tentative replacement had not happened.
n Don't change this one; just go on to the next one.
^G Don't change this one or any others in this file, but instead simply go on to the next file.
! Change the rest in this file without asking, then go on to the next file (at which point qsubst will start asking again).
? Print out the current filename and ask again.
The first two arguments to qsubst are always the string to replace and the string to replace it with. The options are as follows:
-w The search string is considered as a C symbol; it must be bounded by non-symbol characters. This option toggles. ('w'
for 'word'.)
-!
-go
-noask Enter ! mode automatically at the beginning of each file.
-nogo
-ask Negate -go, that is, ask as usual.
-cN (Where N is a number.) Give N lines of context above and below the line with the match when prompting the user.
-CAN (Where N is a number.) Give N lines of context above the line with the match when prompting the user.
-CBN (Where N is a number.) Give N lines of context below the line with the match when prompting the user.
-f filename The filename argument is one of the files qsubst should perform substitutions in.
-F filename qsubst reads filename to get the names of files to perform substitutions in. The names should appear one to a line.
The default amount of context is -c2, that is, two lines above and two lines below the line with the match.
Arguments not beginning with a - sign in the options field are implicitly preceded by -f. Thus, -f is really needed only when the file name
begins with a - sign.
qsubst reads its options in order and processes files as it gets them. This means, for example, that a -go will affect only files named
after the -go.
The most context you can get is ten lines each, above and below.
str1 is limited to 512 characters; there is no limit on the size of str2. Neither one may contain a NUL.
NULs in the file may cause qsubst to make various mistakes.
If any other program modifies the file while qsubst is running, all bets are off.
AUTHORS
der Mouse <mouse@rodents.montreal.qc.ca>
BSD September 4, 1999 BSD