Redirect sed output to a temp file and rename it to source file like
If the sed command fails, the above suggestion will destroy the input file.
will only replace sourcefile if the sed succeeded and it will preserve permissions and links to sourcefile (which might not be important unless there are multiple hard links to sourcefile or the permissions on sourcefile are different from what will be set with your current umask setting).
Last edited by Don Cragun; 01-14-2016 at 04:56 AM..
Reason: Fix typo: s/your what/what/
These 2 Users Gave Thanks to Don Cragun For This Post:
Hi
I have the following file that i need to run a sed command on
1<tab>running
2<tab>running
3<tab>running
4<tab>running
I want to be able to replace a line i.e the second one with '2<tab>failed'. As the first number is unique that can be used to search for the relevant line (using ^2 i... (5 Replies)
I need to remove the '&' from a file.
In each line of the file, the fields are separated by ^K.
I only want to remove '&' if it exists in field number 9. (example of field 9: abc&xyz)
I need to do an in place/in line edit.
So far I have accomplished the following:
awk -F '^K' '{print... (6 Replies)
Hi,
I have a file that I would like to translate using sed.
I can do some basic sed commands, but Im afraid this level is beyond me.
I have this file -
...alter...
..
...65536...
...
...65536...
...
...alter...
...
...65536...
etc
What I would like to do is replace the first... (11 Replies)
Hi using the below cmd i am identifying wheether last character in each line in thousands of files as semicolon or not.If last character is semicolon i am removing semicolon .If last character is not semicolon then i am appending next line to present line .
For example my input file consists of... (4 Replies)
Hi
Can anyone provide me the replacement of sed with xargs perl syntax for the below
sed -e :a -e '/;$/!N;s/\n//; ta' -e 's/;$//'
This should be without looping has to take minimal time for search (0 Replies)
This seems like it should be an easy problem, but I'm a noob and I can't figure it out. I'm trying to use sed, but would be happy to use anything that does the job.
I am trying to trim off a fixed number of unknown characters from 2 different : delimited fields while keeping the intervening... (4 Replies)
I am trying to replace the line which has string "tablespace" not case senstive....
with below simple script: mysrcipt.sh
sed "s/.*/TABLESPACE USERS/g" create_table > tmp
mv tmp create_table
Is there any better way to do it? If Search string tooooooo long it will be tough to code in... (4 Replies)
Hi,
i have a file with lines,
file.txt
-------
test is fun
testing is better
I need to replace 'test' to 'develop' and i used,
a=test
b=develop
sed "s,$a,$b,g" -------- but i see the word 'testing' is also replaced. Need some solution. Is there any way i could replace only 'test' ? (4 Replies)
Hi
,"environment":"accent-release","build":"ac-1112_c_Alph_Nop-release_rele-1112_c_Alph_Nop-release_rele","tags":""
above is the config file, where in i want to replace value after build inside the double quotes... that value i'll be passing as parameter
for example if m passing
... (1 Reply)
Hello,
I'm using Bash and Sed to replace text within a text file (1.txt) twice in one script. Using a for loop I'm initially replacing any 'apple' words with the variable 'word1' ("leg). I'm then using another for loop to replace any 'apple' words with the variable 'word2' ("arm"). This task is... (2 Replies)
Discussion started by: Flip-Flop
2 Replies
LEARN ABOUT REDHAT
psorder
PSORDER(1) General Commands Manual PSORDER(1)NAME
psorder - PostScript pageorder filter
SYNOPSIS
psorder [ -duf ] sourcefile
DESCRIPTION
psorder is a filter that re-orders the pages of a PostScript document. The result is written to the standard output. By default, docu-
ments are processed into ascending order (the lowest numbered page is printed first). Some PostScript documents specify that the order of
their pages should never be changed; the default action of psorder is to follow this specification.
If no source file is given, or if sourcefile is `-', psorder reads from the standard input file.
OPTIONS -d Re-order the pages of the document in downward or descending order. This is typically used to change the order of a document to be
printed by a printer that stacks pages face-up, such as an Apple LaserWriter or LaserWriter Plus.
-u Specifies forward order, and is the default. It is used to try and ensure the correct ordering when a document will be printed by a
printer that stacks the pages face-down.
-f Force psorder to re-order the pages, even if the document claims that its page order is not to be trifled with. This option should
only be used experimentally, as it may cause documents to print incorrectly.
SEE ALSO psf(8), lpr(1).
netatalk 1.2 17 Dec 1991 PSORDER(1)