Sponsored Content
Top Forums Shell Programming and Scripting how to replace a string in the last shell command Post 302484413 by wljackhero on Friday 31st of December 2010 01:49:37 AM
Old 12-31-2010
how to replace a string in the last shell command

for example
the last command i run is:
tail -f 2010123114_mta2.wmwm.com_postfix-MDAD.log | grep XXXX
and i want to raplace '2010123114' with '2010123115', and i don't want to go back to the position and delete 4 and add 5
is there a way to replace a string? like

!!//123114/123115

or something like this

i used to read a article about this but i forget
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to find and replace string in multiple files

I used the following script cd pathname for y in `ls *`; do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y; done and it worked fine for finding and replacing strings with names etc. in all files of the given path. I'm trying to replace a string which consists of path (location of file) ... (11 Replies)
Discussion started by: pharos467
11 Replies

2. UNIX for Dummies Questions & Answers

How to perform string replace in shell script?

I have value like ABCDEF,BBCCDD in a shell variable, now i would like to have ABQWEF,BBQWDD in the same shell variable. How can i replace the char at position 3&4 with QW in shell script? (3 Replies)
Discussion started by: vel4ever
3 Replies

3. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

4. UNIX for Dummies Questions & Answers

Replace backslash at the end of the string using sed command

I have text file which is a tab delimited one. Sample data from the file is shown below: unix is\ great\ os linux\ is superb I want to replace that backslash with empty string preserving the tab delimiter. Output should be unix is great os linux is ... (3 Replies)
Discussion started by: p.akhilreddy4u
3 Replies

5. Shell Programming and Scripting

sed command to replace string that contain blackslash,double quotes

Hi All, I have been trying to replace a string using the sed command string value contain blackslash and double quotes. I am not a expert writer of unix script but do try not to ask question. I have almost given up. Hope you all can give me some suggestion I want to replace a place string... (6 Replies)
Discussion started by: thanush9sep
6 Replies

6. UNIX for Advanced & Expert Users

BASH Internal : Replace pattern with string without external command

Morning, I'm trying step up my scripting game .. :rolleyes::confused::D Is there a way to do the replacement with an or without using an external command ? I did try but no joy. var=${var//\(|\)/} #!/bin/bash var="lulus.UbiRwidgets.com (10.1.1.1)" var=${var//\(/}... (5 Replies)
Discussion started by: popeye
5 Replies

7. UNIX for Beginners Questions & Answers

Shell Scripting , need to search and replace a string in AIX

Hi Guys, I need to search and replace a string in AIX using variables and should be case insensitive. I am able to search and replace using below command but its not working as case insensitive. cat abc.txt | sed -e 's/$a/$b/g' > abc.txt But i need to perform this with case... (9 Replies)
Discussion started by: mohit_vardhani
9 Replies

8. UNIX for Beginners Questions & Answers

Replace matches string in each line with the arrayvalue in shell

I have a list of value , and need to replace that in my file. Eg: File1 tcname:fail tcname: Pass tcname:skipped File2: 01,02,03 Output: File 1 01:fail 02: Pass 03:Skipped (8 Replies)
Discussion started by: DevAakash
8 Replies

9. Shell Programming and Scripting

Replace string works on command-line but fails when run from shell script

I wish to replace "\\n" with a single white space. The below does the job on command-line: $ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g'; /fin/app/scripts /fin/app/01/sql However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
Discussion started by: mohtashims
8 Replies

10. Shell Programming and Scripting

Unable to replace string in AIX ksh shell

My variable contains the following string I wish to replace \n with "space" so the expected output is: I understand that the /n is not a new linein this case. I'm on AIX using ksh shell. Below is all that I tried. echo $str | sed -e "s#\n# #g"; echo $str | sed -e "s#\n#' '#g";... (5 Replies)
Discussion started by: mohtashims
5 Replies
SM(1)							    InterNetNews Documentation							     SM(1)

NAME
sm - Command-line interface to the INN storage manager SYNOPSIS
sm [-cdHiqRrSs] [token ...] DESCRIPTION
The INN storage manager is the subsystem that stores and keeps track of all of the articles and what storage backend they're in. All stored articles are assigned a storage API token. sm is a command-line interface to that storage manager, primarily used to retrieve articles by those tokens but also to perform other operations on the storage subsystem. token is the token of an article (the same thing that's returned by grephistory or stored in the history file). It looks something like: @0502000005A4000000010000000000000000@ Any number of tokens can be given on the command-line for any function other than -s. If none are, sm normally reads tokens from standard input, one per line. The default operation is to retrieve and write to standard output the corresponding article for each token given. If -s is given, sm instead stores the article given on standard input (in native format, not wire format) using the standard rules of the storage subsystem. If the article is stored successfully, the token of the article is printed to standard output. Please note that this does not make any attempt to write a history entry or any overview data, and is therefore only useful under very specific circumstances. OPTIONS
-c Show a clear, decoded form of the storage API token. Each part of the token is explained, in a human-readable string. Amongst other elements, this command gives the path to where the corresponding article is supposed to be stored. -d, -r Rather than retrieving the specified article, remove the article. This will delete the article out of the news spool and it will not subsequently be retrievable by any part of INN. It's equivalent to "ctlinnd cancel" except it takes a storage API token instead of a message-ID. -H Retrieve only the headers of the article rather than the entire article. This option cannot be used with -d, -r, -i, or -S. -i Show the newsgroup name and article number associated with the token rather than the article itself. Note that for crossposted articles, only the first newsgroup and article number to which the article is associated will be returned. -q Suppress all error messages except usage errors. -R Display the raw article. This means that line endings won't be converted to native line endings and will be left as CRLF sequences; leading periods will still be escaped for sending over NNTP, and the article will end in a CRLF.CRLF sequence. -S Write the article to standard output in the format used by rnews spool files. Multiple articles can be written in this format, and the resulting output can be fed to rnews (on another system, for example) to inject those articles into INN. This option cannot be used with -d, -r, -H, -i, or -R. -s Store the article given on standard input using the normal storage rules for articles as configured in storage.conf(5). Print the new token for the message to standard output if it is stored successfully. If this option is given, no other options except possibly -q should be given. EXIT STATUS
If all operations were successful, sm exits with status 0. If an operation on any of the provided tokens fails, sm will exit with status 1, even if the operations on other tokens were successful. In other words, if twenty tokens are fed to "sm -r" on stdin, 19 articles were successfully removed, but the sixth article couldn't be found, sm will still exit with status 1. This means that if you need to be sure whether a particular operation succeeded, you should run sm on one token at a time. HISTORY
Written by Katsuhiro Kondou <kondou@nec.co.jp> for InterNetNews. Rewritten in POD by Russ Allbery <rra@stanford.edu>. $Id: sm.pod 8818 2009-11-17 18:58:24Z iulius $ SEE ALSO
ctlinnd(8), grephistory(1), history(5), rnews(1), storage.conf(5). INN 2.5.2 2010-02-08 SM(1)
All times are GMT -4. The time now is 11:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy