03-29-2011
I wanna replace ONLY the last occurrence of AAA using one shell command such as sed or awk.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi I need to help on finding the below pattern using sed
<b><a href="/home/document.do?assetkey=x-y-abcde-1&searchclause=photo">
and replace as below in the same line on the index file.
<b><a href="/abcde.html">
thx in advance.
Mari (5 Replies)
Discussion started by: maridhasan
5 Replies
2. Shell Programming and Scripting
Hello All,
I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below.
# echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print... (4 Replies)
Discussion started by: racbern
4 Replies
3. Shell Programming and Scripting
Hi ,
My file have data like
4:ALMOST NEVER PR 1925836
5:NEVER PR W DDA 5857610
6:NEVER PR WO DDA 26770205
but i want to replace the spaces before last numric digits out put should be like this
4:ALMOST NEVER PR=1925836
5:NEVER PR W DDA=5857610
6:NEVER PR WO... (7 Replies)
Discussion started by: max_hammer
7 Replies
4. Shell Programming and Scripting
I have a file with multiple lines like this:
<junk><PATTERN><junk><PATTERN><junk>
<junk><PATTERN><junk><PATTERN><junk><PATTERN><junk>
Note that
1. There might be variable number occurrences of PATTERN in a line.
2. <> are just placeholders, they do not form part of the pattern.
I need... (4 Replies)
Discussion started by: flatley
4 Replies
5. Shell Programming and Scripting
Hi all,
I'm trying to replace a pattern/string in about 100 files with the filename using following commands but getting nowhere:
for f in *.fa; do sed "s/^>.*/>$f/g" $f > $f_v1.fa; done
for f in *.fa; do sed 's/^>.*/>`echo $f`/' > $fa_v1.fa; done
Basically I want to change any line... (5 Replies)
Discussion started by: ivpz
5 Replies
6. Shell Programming and Scripting
Not able to paste my content. Please see the attachment :-( (2 Replies)
Discussion started by: vivek d r
2 Replies
7. Shell Programming and Scripting
I've got a file like so:
...lots of lines, etc.
push "route 10.8.0.0 255.255.255.0"
push "route 192.168.1.123 255.255.255.0"
...lots of lines, etc.
I want to sed find/replace the IP address in the second line, whatever it is, with a new IP address, but I don't want to touch the first line.... (5 Replies)
Discussion started by: DaHai
5 Replies
8. Shell Programming and Scripting
Hi Guys!
Unix newbie here!
Have a requirement for which I have been scouting the forums for a solution but has been out of luck so far :(
I have a file which contains the following:-
TEST1|TEST2|"TEST3|1@!2"|TEST5
My sed command should result in either one the following output:-... (6 Replies)
Discussion started by: hishamzz
6 Replies
9. UNIX for Beginners Questions & Answers
I have a file with multiple lines, all in the same format. For each line, I need to replace the sequence of digits after the last : with a new value, but keep the single quote at the end of the line.
Example:
Input: ( two lines of file)
Name: 'text1:200/text2:1.2.3.4'
Name2:... (19 Replies)
Discussion started by: Beginner101
19 Replies
10. UNIX for Beginners Questions & Answers
Hi,
i want to replace the following lines in such a way that if the word merge exists in first column it must replace the 3rd column as M and if parse exists in first column then the last column must P, if neither it must mark it as X. I have tried the solution using awk, but it is saying... (6 Replies)
Discussion started by: charlie87
6 Replies
LEARN ABOUT DEBIAN
replacekey
replacekey(1) General Commands Manual replacekey(1)
NAME
replacekey - replace keywords in a FITS header
SYNOPSIS
replacekey [options] <in>
DESCRIPTION
replacekey is aimed at replacing keywords in a FITS file's header by new keywords provided by the user on the command-line.
ALGORITHM
The user can provide a new_keyword, an old_keyword, a value and a comment. first searchs for old_keyword if provided. If it finds it, it
replaces the associated card by the new one (new_keyword=value/comment). If old_keyword is either not found or not provided, associated
card by the new one (new_keyword=value/comment). new_keyword has to be provided.
Examples: You want to change the value of VALUE from 32 to 16 in myfile.fits: % replacekey -k "VALUE" -v "16" myfile.fits
If you want to replace the card with the keyword OLD by "NEW = 3.14 / This is a usefull key" in myfile.fits: % replacekey -k "NEW" -v
"3.14" -c "This is a usefull key" -K "OLD" myfile.fits
If your do not care about the HISTORY cards you have in the header, and want to replace the first one by VALUE=32, you would do:
% replacekey -k "VALUE" -v "32" -K "HISTORY" myfile.fits
OPTIONS
-k or --key key
To provide the new keyword.
-K or --old key
To provide the old keyword.
-v or --val val
To provide the new value.
-c or --com com
To provide the new comment.
SEE ALSO
hierarch28 to convert HIERARCH ESO keywords to regular 8-char keywords.
FILES
Files shall all comply with FITS format
BUGS
Modifications are so far only possible in the main header, not in the extensions.
28 Oct 1999 replacekey(1)