I'm trying to craft a tricky regex using Sed. I'm trying to clean up some code which has bazillions of lines over 80 characters in length, mainly because of these end-of-line comments. I want to change them to a nicer format. I've put the code on Pastebin because the formatting is better: [URL]. Bear in mind those are tabs, not spaces.
There is an internet page that displays streaming videos (TV shows) that are not detected by most Windows and Linux downloading software: Orbit, Replay Media Catcher (Windows) or Video Downloader, Downloadhelper, etc in Linux (ubuntu)
In Windows the only program that I managed to do the job with is "Stream Transport", and got .mp4 files that I could watch later.But I don't have windows anymore, it is corrupted. In ubuntu, however, the many firefox add-ons, stand alone programs that I tested, don't see the video file. In the source of the page I don't understand anything, everything is concealed under javascript text... The video is not saved in the firefox cache.
How can I capture it? Does anybody know how to deal with this kind of well-concealed video files?In theory, it should be possible to record everything that comes into the machine, but how?
P.S. By TRICKY I mean something non-standard (not ....., dailymotion, etc).
I'm writing a script that picks out the time offset in a string, but am trying to figure out a way to print a field based on a match (likely needs to be regex).
Here are some sample fields: 09.900. Either add -12:-1: 0 to existing offset, or restart the slicer with no offset or with offset=00 09.900. Either add -12:-1:30 to existing offset, or restart the slicer with no offset or with offset=00 09.900. Either add -10: 0:-47 to existing offset, or restart the slicer with no offset or with offset=00
What I need would be "-12:-1: 0" from the first line, for example. I was just using "awk '{print $4}'" originally but because of the damn space in the 1st and 3rd lines by the 0, that doesn't work for me. How to grab those fields correctly for all cases?
Using netcat, nc(1), craft a valid http/1.1 request for getting http headers (not the html file itself!) for the main index page of www dot aalto dot fi. What request method did you use? Which headers did you need to send to the server? What was the status code for the request? Which headers did the server return? Explain the purpose of each header.
nc -v www dot aalto dot fi 8080 HEAD / HTML/1.1 host: www dot aalto dot fi And it returns: 200 OK Content-Length: 858 Content-Type: text/html Last-Modified: Thu, 02 Sep 2010 12:46:01 GMT [Code]....
I really don't know what does it mean. Question 2: Using netcat, nc(1), start a bogus web server listening on the loopback interface port 8080. Verify with netstat(, that the server really is listening where it should be. Direct your browser to the bogus server and capture the User-Agent: header "Direct your browser to the bogus server and capture the User-Agent: header" I don't understand this question.
This makes me feel like a total n00b but I'm trying to figure out how to replace an XML close tag (such as </pagenum> ) with the same XML close tag followed by yet another close tag. (I want every occurrence of '</pagenum>' to be replaced with '</pagenum></p>').
I've tried using something like this: Code: sed 's/</pagenum>/</pagenum></p>/' old.xml new.xml What am I missing? Please forgive me. I'm diving head first into RegEx.
At my work i have a legacy web system that tells the id of documents based on some given variables. this information can be used in another system to retrieve the needed file.
I am trying to automate this, and have managed to feed the variables and download the correct page using wget. The result is a result.php page with a lot of embedded info.
The information i am looking for is enclosed in single quotes on a line like this:
The information i want is the 1234 part.
I thought i could do like this from bash:
But I always get an empty string back... any idea what i am doing wrong?
My friend lost her dissertation and she had only a pdf copy of it. I am trying to convert the pdf into an odt format. After copy-pasting the content into an odt, i need to replace all paragraph breaks which are not following a dot with a space. For which i thought of using the regular expression feature of Libre Office. I've not succeeded so far.
I tried: to replace [:alpha:]$ or [a-z]$ or [a-z]>$ with space, but none of them worked. Finding [a-z] seems to work, finding [a-z]> too. So did finding $ (end of paragraph) but if i combine any regex with $ then it doesn't find anything.
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.
So I just recently downloaded Regex-PreSuf. I believe it downloaded correctly, and also install correctly (did the following):
> downloaded it > gzipped > tar'ed > perl Makefile.PL > make > make test > make install
This is the file listing after the make install completed:
[Code]....
The output from the make, and make install gave the All OK, but there is no documentation with it that shows how to use it? Does anyone know what you have to do to use it? From what I read, it is used to enter a string and it gives you the regex that matches that string exactly? This is what I tried, from within the directory and its the output:
Are there some good tutorials or reference materials on how do pattern matching and text manipulation in Linux?I have a few simple tasks I'd like taken care of...like formatting numbers in file names, stripping some text from directory names, etc
regex in grep? I need to match ANYTHING in the following with any character combination (something like * in findstr in C): grep "Delivery of nonspam" /var/log/mail.log | grep "to [URL]"
In a bash-script, only the case if a regular expression does not match is relevant.herefore I used the exclamation mark !. But where to place it?
These two work fine, but are they equivalent? Code: if ! [[ $abc =~ $pattern ]]; then or Code: if [[ ! $abc =~ $pattern ]]; then Where is the ! placed more correct?
I'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash
for i in $(ls -d /Users/*) doif [ -e $i/.tcshrc ] thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"
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.
I'm using bash scripting to find any file that matches a path governed by the following regular expression:
"(monthly|nightly).[0-9]+/home/(user1|user2)/.mailbox/" to match files like: monthly.9/home/user1/.mailbox/l23131564 nightly.15/home/user2/.mailbox/cur/6546213
Today I moved my Slackware64-current installations to multilib. I blacklisted the gcc and glib packages in the blacklist-file for slackpkg. In the blacklistfile they say:
Code: # Now we can blacklist using regular expressions. # This one will blacklist all SBo packages: #[0-9]+_SBo I have blacklisted
I'm attempting to use REGEX to isolate media (video and audio) essence that relate to alias/reference Quicktime movies. The Quicktime movie filename (excluding ".mov" can always be found in the media-essence filename.Stages of my process are:I cache the contents of a text file into an array ($file). This text file/array contains a list of Quicktime movies and media essence. Essence for each Quicktime movie is contained in this text file. An example text file is below:
So those of you that know me will agree that when it comes to awk I don't usually ask a lot of questions ... however this one has me stumped. I am guessing I have missed something obvious but for the life of me (and I have tested at great length) I cannot find it So the scenario is this: The following awk code should identify all versions of libgpg-error within the attached file (see below) and only show one for each version:
I'm writing a script to read user input for a computername.I need a check that a given userinput is valid.Right now I use grep like this (for sure not optimal):Quote:
if echo "$name" | grep -q '[^a-z][^A-Z][^0-9]'; then echo error else
the following works and BASH doesn't complain, but VIM highlights the closing square bracket is if it sees a syntax error. Is there a better way to express regex in a case statement or is this an issue with VIM?