09-29-2018
Regex with sed
hi
i would like to say "DATABASENAME=" to "TABLESNAME="
remove "," and press enter myconfig file
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to do this:
replace the word "prod" with the word "special" but it may occur through the file naturally without a command, I only want it to happen when it has a specific command in front of it. The command will always look like this
<IMG,###,###,##,>prod/directory/IMG/file
... (4 Replies)
Discussion started by: Shakey21
4 Replies
2. UNIX for Dummies Questions & Answers
so i have been trying to learn how to manipulate text on my own and have gotten stumped...
let's say i have a text file that says (highly simplified):
people ordinary
How would swap the order of the words..
I know i need to use sed and some kind of back reference but cannot make it... (2 Replies)
Discussion started by: urtherhoda
2 Replies
3. Shell Programming and Scripting
Hi all,
I'm writing a script that replaces a value in a file. The file is formatted as follows:
So, for this example, I'd like to replace the value for param_two. The value for param_two can be a one, or two-digit number. It replaces the value in file.cfg, and directs the... (9 Replies)
Discussion started by: marknu1
9 Replies
4. Shell Programming and Scripting
From my understanding when using regex1|regex2 the matching process tries each alternative in turn, from left to right, and the first one that succeeds is used.
When im trying to extract the name from those examples:
A) name.can.be.different.20.03.2009.boom
B)... (2 Replies)
Discussion started by: TehOne
2 Replies
5. Shell Programming and Scripting
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies
6. UNIX for Advanced & Expert Users
Hi,
I tried to extract the time from `date` with sed.
(I know it works with `date +%H:%M:%S` as well)
I got three solutions of which just one worked. I thought "+" should repeat the previous expression 1 or more times and {n} should repeat the previous expression n times.
$ date
Thu... (9 Replies)
Discussion started by: thiuda
9 Replies
7. Shell Programming and Scripting
Hi,
I need to use the regex in the replacement string in SED command.
something like
sed -e ' s/\(^\{5\}\).\{150\}\(.*\)$/\10\{30\}1\{30\}A\{60\}B\{30\}\2/' abc
which means for all the lines in file abc that starts with 5 characters, I need to replace character 6-151... (6 Replies)
Discussion started by: snowline84
6 Replies
8. Shell Programming and Scripting
I plan to do something like this in awk that's embedded in a shell script.
I have extracted a text file using awk and the output is
before example:
<USDOLLARS|xxx>
I want to use get rid of the starting "<" and anything after the pipe "|"
after example:
USDOLLARS
How do I do that??
I... (8 Replies)
Discussion started by: deadyetagain
8 Replies
9. Shell Programming and Scripting
Hi all, please can anyone show me how to use sed and regular expressions to achieve the following.
If a line contains a capital A followed by exactly 5 or 6 characters followed by an angled bracket then insert an asterix before the angled bracket.
So:
XCONFIGA12345<X
Becomes:
... (5 Replies)
Discussion started by: Jedimark
5 Replies
10. Shell Programming and Scripting
I am using the following sed script to remove new lines (\r\n and \n), except from lines starting with >:
sed -i ':a /^>/!N;s/\r\n\(\)/\1/;s/\n\(\)/\1/;ta'
Is there a way to include both \r\n and \n in one regex to avoid the second substitute script (s/\n\(\)/\1/)? (4 Replies)
Discussion started by: Xterra
4 Replies
LEARN ABOUT DEBIAN
notmuch-mutt
NOTMUCH-MUTT(1) User Contributed Perl Documentation NOTMUCH-MUTT(1)
NAME
notmuch-mutt - notmuch (of a) helper for Mutt
SYNOPSIS
notmuch-mutt [OPTION]... search [SEARCH-TERM]...
notmuch-mutt [OPTION]... thread < MAIL
notmuch-mutt [OPTION]... tag [TAGS]... < MAIL
DESCRIPTION
notmuch-mutt is a frontend to the notmuch mail indexer capable of populating a maildir with search results.
OPTIONS
-o DIR
--output-dir DIR
Store search results as (symlink) messages under maildir DIR. Beware: DIR will be overwritten. (Default:
~/.cache/notmuch/mutt/results/)
-p
--prompt
Instead of using command line search terms, prompt the user for them (only for "search").
-h
--help
Show usage information and exit.
INTEGRATION WITH MUTT
notmuch-mutt can be used to integrate notmuch with the Mutt mail user agent (unsurprisingly, given the name). To that end, you should
define macros like the following in your Mutt configuration (usually one of: ~/.muttrc, /etc/Muttrc, or a configuration snippet under
/etc/Muttrc.d/):
macro index <F8>
"<enter-command>unset wait_key<enter><shell-escape>notmuch-mutt --prompt search<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<enter>"
"notmuch: search mail"
macro index <F9>
"<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt thread<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<enter><enter-command>set wait_key<enter>"
"notmuch: reconstruct thread"
macro index <F6>
"<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt tag -inbox<enter>"
"notmuch: remove message from inbox"
The first macro (activated by <F8>) prompts the user for notmuch search terms and then jump to a temporary maildir showing search results.
The second macro (activated by <F9>) reconstructs the thread corresponding to the current mail and show it as search results. The third
macro (activated by <F6>) removes the tag "inbox" from the current message; by changing "-inbox" this macro may be customised to add or
remove tags appropriate to the users notmuch work-flow.
To keep notmuch index current you should then periodically run "notmuch new". Depending on your local mail setup, you might want to do that
via cron, as a hook triggered by mail retrieval, etc.
SEE ALSO
mutt(1), notmuch(1)
AUTHOR
Copyright: (C) 2011-2012 Stefano Zacchiroli <zack@upsilon.cc>
License: GNU General Public License (GPL), version 3 or higher
perl v5.14.2 2012-06-02 NOTMUCH-MUTT(1)