General :: Regex Escape The Comma?

Aug 12, 2010

sometimes there are one, sometime there are two exchanges in this log file. the 100= is the stock exchange- if there are two, they are seperated by a comma. i understand how to escape a comma in a regex, but I am having trouble with combining it.

35=8 39=1 38=1000 32=13 14=754 31=1.11 44=1.1 100=AMEX,ISE
35=8 39=1 38=1000 32=151 14=205 31=1.1 44=1.1 100=AMEX
35=U 39=2 38=1000 32=45 14=184 31=1.1 44=1.1 100=AMEX,ISE

[code]...

View 11 Replies


ADVERTISEMENT

General :: Adding A Comma To The End Of Every Nth Line In Vi (or Sed)?

Oct 12, 2009

I have a fairly long list of data that I am trying to put into a math program (maple) but before I can do that I need to edit the format of the data such that at the end of every 25th line I add a comma. I would prefer a solution that uses vi, but if that's impossible sed would be fine also (or awk).

View 6 Replies View Related

General :: Output Pid's From Ps To A Comma Delimited File?

Apr 7, 2010

need to monitor pecific processes over a time frame in terms of the amount of memory and cpu usage it utilizes. I can do this using the top -p <pid> option and using ps to retrieve the pid's. However, seeing that the pid's might differ and it needs to be run on about 13 different machines, I would like to write a script for this that can be run at set intervals. My problem that I have is this:

- When running top -p <pid> I can specify a comma seperated list of the processes required to monitor at that specific time.

- I can use ps -ef | grep <process> | grep -v grep| awk '{ print $2 }' to retrive the list of pid's and output this to a file.

However, how can I output these to the file as a comma seperated list without having to manually do this every time? The reason for this is (an example), lets say I want to monitor the cpu and memory usage of postgresql as well as all its child processes, then I would ps grep for postgres and get the list of pid's for instance.This list then needs to be passed to top -p as a comma seperated list of pid's I suspect that awk or sed might have some options available for this but I do not know this well enough.

View 11 Replies View Related

General :: Count Words With Comma As Separator?

Feb 16, 2010

I'm trying to count words in a text file that has a comma as separator. I know that I must user wc -w, but wc uses space as a separator

View 2 Replies View Related

General :: Removing The Comma From A Currency Entry?

Apr 24, 2010

I have a file of the formcol1, col2, $330,000, col4 ...col1, col2, col3, col4 ..col1, col2, $230,000, col4 ...The comma within the currency value causes the column to display unevenly when I open it so I want to remove it. I think I should be able to use the sed command but I am not sure extactly how. All the values have 3 digits after the $ and before the , so have triedsed -e 's/$[0-9]*,/ but I am not sure how to 'replaced with the string found just without the comma'So two guestions:1. Is this a good way to do it?2. How do I do it

View 8 Replies View Related

General :: Randomize The Comma Separated String In Shell?

Oct 10, 2010

I wanted to randomize the comma separated string.String like "test1,test34,test5,test6".And it would be displayed differently when I ran each time.

Expected output like "test5,test6,test1,test34".

View 13 Replies View Related

General :: Remove Line Breaks From Lines Ending With A Comma?

Nov 10, 2010

I have a CSV file that's created in an application that can't output lines longer than 250 characters. the data fields, all together, are longer than this. how would I remove the line break from every line that ends with a comma? For example:

A,B,C
D,E,
F
G,H,I

becomes:

A,B,C
D,E,F
G,H,I

View 1 Replies View Related

General :: Awk/regex With A Post?

Apr 2, 2010

I have a data file with the following format 0 i j # # # # with other random lines of text to be filtered out.The following script works when there aren't many #s, but it shuffles long lists of data.

/^0/ {
split($0,token)
printf("%s %s ", $2, $3)

[code]...

View 4 Replies View Related

General :: Escape Commands In A Bashrc Alias?

Sep 17, 2010

I need to occasionally touch a file with the current timestamp as the filename. I would do so this way:

touch `date "+%Y-%m-%d_%H-%M"`.txt

However, I'd like to define an alias for this. When I try adding to the bashrc this:

alias td="touch `date "+%Y-%m-%d_%H-%M"`.txt"

the result is that the filename is the same during the entire session, since the `date ..` gets calculated just once during login...

How can I get the command to expand only when I call the alias? Or must I use a function for this?

View 1 Replies View Related

General :: Substituting Lines In Files Without Need To Escape?

Jan 17, 2011

Usually when I need to replace some lines in a file, the first tool that comes to mind is sed -i:

sed -i 's|tool:.*|tool: some-tool|'

However, it's inconvenient when there are . characters in the replacement string:

sed -i 's|host:.*|host: 127.0.0.1|' Is there a better tool for this case?

View 1 Replies View Related

General :: Escape Characters In Watch Command

Oct 20, 2009

Need little advice running this command.
watch -d 'ps aux | awk '{print $4" "$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr | head'

I get this error message from AWK. awk: cmd. line:1:
{print awk: cmd. line:1: ^ unexpected newline or end of string

I have tried all the usual by trying to escape the single and double quotes in the command but same result. The end result should be the a listing of memory hungry processes that are scanned every 2 seconds (watch default value).

View 2 Replies View Related

General :: Fedora14 Want To Mount Joliet Cd Escape Seq 25,2f,40

May 3, 2011

i have a cd that shows you an empty directory unless you mount it for the joliet extensions - specifically 25 2f 40. It uses wide characters with the high half null.

View 3 Replies View Related

General :: Which Regex Standard Is Used In Grep?

Apr 12, 2011

I'm wondering if it's POSIX + ASCII or something else is mixed in?

View 1 Replies View Related

General :: Regex Edit In Skype?

Jan 13, 2010

I am not a big skype user, but I was chatting with my sister, made a typo and habitually typed

tpyo
s/tpyo/typo/

to my surprise it actually changed the history. I am using the linux skype client 2.1.0.47-r1 and my sister is using 4.something on windows.

When she tried to do the same thing, it didn't work. Does anyone know if this is specific to the linux version?

View 1 Replies View Related

General :: Printing Transcript With Ansi Escape Sequence?

Aug 8, 2010

Is there a way to print a transcript generated using script that is coloured using ansi escape sequences while preserving the colours?

I am on OS X 10.6, but any tool that works on OS X or on Linux that can print or create a pdf file will be extremely helpful.

View 1 Replies View Related

General :: Removing The Escape Characters From GNU Screen's Screenlog.%n?

Jan 22, 2010

Is it possible to remove the ESC sequences in GNU Screen's output file? Things such as colours, tabs and other escape characters make their way into the log files and become difficult to decipher.

I've tried Dr. Google & Co. as well as reading the manual, but haven't been able to find anything suitable.Perhaps I've overlooked something?

View 3 Replies View Related

General :: Escape From Evolution And Have Thunderbird Be My Default Email?

Feb 25, 2011

Fedora 14

When I started I took the defaults and ended up with Evolution.

I have never managed to get it set up to send. It and godaddy are on diffferent planets.

Having used Thunderbird in the past, I downloaded it and it automagically set itself up to send and receive.

So now I use Thunderbird - BUT - when I click on a link in an html page - the mailto macro sends me to something other than THunderbird - perhaps Evolution - and nothing gets sent.

So how do I tell the system that when i click a mailto in firefox I want Thunderbird?

PS I think I found it. In firefox - edit - preferences - applications tab - mmailto - it said Evolution. I changed it so say /usr/bin/thunderbird - will now test it.

YES - Seems that asking a question triggers my brain on how to resolve it. Sorry to waste your time.

View 1 Replies View Related

General :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 Replies View Related

General :: Sed Regex To Match Words Via A Pattern

Oct 24, 2010

I have some lines of text and I want to detect words that meet some criteria with sed.

E.g. The line "tetris cat dog test cactus stereotype"

I want to detect the word that contains two (2) ore more t letters. That mean the words tetris, test and stereotype.

The following regex doesn't do the job because it can;t distinguish words very well.

I thinks I have ti incorporate something like [^ ] in the regex but I wasn't successful...

View 3 Replies View Related

General :: Terminal That Supports ANSI Italic Escape Code?

Oct 29, 2010

I would like to replace gvim with vim in the terminal. One of the nice things about gvim is that it is able to display text using italics.

Vim allows setting an ANSI escape code for italics (e[3m), but this does not work in gnome-terminal. Is there a terminal emulator that supports the ANSI escape code for italics?

View 1 Replies View Related

General :: Escape Forward Slash But Not Working Statement Garbled?

May 2, 2011

I am trying to use sed command to repalce one string with other but somehow replacement string contains forwards slash hence getting the error statement garbled!

[Code]...

View 4 Replies View Related

General :: Regex - Using Find To Locate Filenames Before A Certain Date?

Jul 11, 2011

I have a ton of files that are timestamped directories. These all look like2011-06-24_13.53.36 // a directory name for june 24th, 1:53:36 pmI have thousands of these directories. I want to do operations on some of the older ones. Let's say I give it a string for date time that matches that exact format, like i'll give it2011-06-25_00.00.00 // june 25th, 12amI want to find all the directories BEFORE my time. So if i give the string for 12am on june 25th, i want to find all the directories before then.If not i can find EVERY directory i have like this and then filter after wards. The created/modified dates are not tied to the actual timestamp im looking for (that would make this easier)

View 2 Replies View Related

General :: Regex To Find Min / Max Length Words In File?

Jan 29, 2011

i am trying to find all 3 and 4-character length words in my file (which is huge and has alot of entries in it, a big fat wordlist!).My attempt with this regular expression (which I thought should work, found something on length search here: [URL]

cat sorted_noapostrophe.txt| grep '.{3,4}'

but it returns no results? Also to find any words starting with 'f' which are between 3 and 5 characters (inclusive) long, how can this be done?

View 4 Replies View Related

General :: Convert Shell Logs - Incl. Escape Characters - To HTML?

Mar 6, 2010

Is there tool or a regexp that can convert shell escape characters to HTML code?

As an example, here is a logfile from GNU screen:

Which I would like to convert to something like this:

And send as HTML e-mail to an e-mail address, to archive my work.

Here is a related question, which shows how to convert it to regular text, but it would be nice to convert to HTML and not just throw the escape characters away.

View 1 Replies View Related

General :: Emacs - Search And Replace Regex In Multiple Buffers?

Apr 7, 2009

I'm fairly comfortable with emacs but I can't seem to find how to do this. I deal with a lot of text files and find myself performing a lot of regular expression replacements to correct the formatting of the text -- or to extract certain tidbits of data from large ugly-looking files.

I know how to perform a regular expression replacement in one buffer at a time. But how do you perform a regular expression search and replace across all open buffers? I have found a method to perform a regex search and replace across a directory by marking files but I need to do it in the open buffers.

View 2 Replies View Related

General :: Perform Action When Clipboard Contents Match Regex?

May 20, 2011

I use the Actions feature of KDE's Klipper utility to run certain commands when I copy something into the clipboard that matches a particular regular expression. Unfortunately, I have to turn on Enable Clipboard Actions and select the command from a menu every time I copy something that I want to run the command on. I'd like to have that command run automatically instead.

You'd think this was possible, as there is an automatic checkbox in the action settings dialog box:

Unfortunately, that appears to do nothing. The documentation included with Klipper does not indicate what that checkbox is supposed to do.

Is it possible to configure Klipper to run a command automatically if the contents of the clipboard matches a regular expression? If not, is there another way to accomplish this?

View 1 Replies View Related

General :: Expressing A Specific Range With Regex And Perl Extractors?

Feb 27, 2010

I am tryng to get values BBA 204- BBA 324 from a log file.

this is my script:

zmore log.gz | perl -nle 'print for m/BBAs[2|3][0-9][0-4]/g' | sort -u | perl -ne 'print if /^BBAs204$/../^BBAs324$/'

the first perl one liner gives me everything from BBA 200 to BBA 394, and the second perl one liner cuts it down to BBA 204 to BBA 324

Is there a elegant regex that will allow me to skip the second perl one liner and just take out the BBA 204 - BBA 324

View 2 Replies View Related

General :: 'find' Command Regex To Exclude Hidden Files?

Jun 28, 2010

I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?

View 3 Replies View Related

General :: Command Line - Print A Group Of Text Matching A Regex?

Sep 22, 2011

I'd like to print only few groups from text matching a regex. How can I do that in the Linux command line?

What other tools for text processing are there in Linux?

View 3 Replies View Related

Programming :: Php Explode By Comma Unless?

Feb 9, 2010

i'm trying to get several strings from a single string, separated by comma's.there are comma's that do not separate strings, however, those enclosed in parantheses.an example would be:vt, word1, (word2, word3)word4

exploding by ',' would result in:
[0]=>vt
[1]=>word1

[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved