Programming :: Cutting Last Part Of URL?
Dec 1, 2010website.com/john/doe/index.htmlI need to cut that to say:website.com/john/doe/I am getting really close using sed, but I just can't get the syntax quite right.
View 2 Replieswebsite.com/john/doe/index.htmlI need to cut that to say:website.com/john/doe/I am getting really close using sed, but I just can't get the syntax quite right.
View 2 RepliesI have a tab-delimited txt file as below. It is part of the original file.Quote:
##Hello
##Welcome
#C1 C2 C3
[code]....
I have an html file like this
HTML Code:
Some more HTML code... I would like to cut the above text so i get this: Sometext on multiple lines like this.Sometext on multiple lines like this.Sometext on multiple lines like this. Sometext on multiple lines like this.Sometext on multiple lines like this.
There are other HTML files with similar cuts I need to do, but once I have the method for doing one, I am sure I can do the others.
I think the two logical strings to cut between would be:
I am not sure if these strings are always the start and end of the line respectively, is this makes a lot of difference! Then the HTML tags would need to be stripped to get the text on its own.
I know the commands for removing tags, but searching for a string like class="IOSSectionTitle", and cutting everything before it etc is something I am finding challenging.
Just thought I would add that the HTML does not nec. appear on logical new lines throughout the file and there may be unexpected new lines, but as far as i know the class="IOSSectionTitle" and <img always appears as a string without any new lines between those characters.
I just used dd to clone a linux partition to a new hard drive, it had 800mb left on the old hard drive, after dd, new hard drive lists 1.29/1.3 terabytes full. Is this what happens by default in dd? How can I fix this?
View 1 Replies View Relatedis it possible in C to use a counter as part of a variable name?
View 2 Replies View RelatedI have this string ./DAT000728-652523058.job.I want to extract the no between DAT and - sign. I want 728. I dont want 000728.echo ./DAT000725-560162365.job | cut -d'T' -f2 | cut -d'-' -f1 I am getting 000728.string can be ./DAT326822-652523058.job also. then i need 326822
View 6 Replies View RelatedThere are a few things I was wondering about (using tools available in bash):How to insert a file at at the specified location of another.How to copy a portion of a file between two lines matching a regex to another file (and/or making sed only work between two lines matching a regex)How would you do this?
View 2 Replies View RelatedI am trying to transpose the following row:
x1 x2 x3 x4
into
x1 X2
x3 x4
With tr '''' < file I can select all columns to become separate rows,but as you see x3 and x4 have to be grouped when transposing.Or should I use awk for this one?
I'm trying to figure out how to access the local part and the domain part of an email address in postfix's main.cf. For example, myname@mydomain.net has myname as the local part and mydomain.net as the domain part.I get the whole email address with %s. I want to speed up the lookups by writing better database queries.I've had no luck finding this in the otherwise well documented postfix.
View 2 Replies View Relatedwe have access to one domain name , 1 internet ip address and may servers hosting different part of site. I want them all to be accessed via same web site . some of the server in our network are embedded devices.they have their specific utility being hosted on that machine. So the severs are bound to be distributed . I just wanted to know how can I access them via single ip, domain name.
View 6 Replies View RelatedI have a macro which I use with ROOT. In this macro I want to check if a part of string exist so I can ignore it inside a loop. So, inside a loop I want to have something like:
Code:
if (string == "pre_ti_data_bdt*" || string == "pre_ti_data_nn*")
continue;
but of course I cannot use * in this piece of code! How to do this trick in C++?
In bootseqence of linux, the first step is check the CMOSRAM(size 64bytes) setup for custmor setting. So i am just confused wether CMOSRAM is a part of motherboard or is a part of RAM itself.
View 4 Replies View RelatedI wish to implement some part of my codes to use the GPU of my graphic card but I have no idea whether GNU as already implemented it (as for OpenMP). I mean, there are PGI Fortran compiler which embedded CUDA but I figure it's not free. I also wonder if that works only with ATI graphic cards or if for instance I can use my Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller.
View 4 Replies View RelatedHow do i run a part of code on exit in a shell script?Suppose i have four echo statements like the following:
echo "Stmt 1"
echo "Stmt 2"
....some code goes here...
[code]...
I work for a company that does remote computer support, we use VNC protocol to help our clients. I installed a VNC repeater that allows my clients to connect to me going through all firewalls and port forwarding. The linux VNC repeater outputs all connection information to /var/log/vnc.log and looks something like
Code:
UltraVnc Linux Repeater version 0.14
UltraVnc Tue Mar 22 03:37:02 2011 > routeConnections(): starting select() loop, terminate with ctrl+c
UltraVnc Tue Mar 22 03:37:12 2011 > acceptConnection(): connection accepted ok from ip: 55.555.555.55
[code].....
I need a script that reads this log file every so often (30 seconds to 5 minutes) and sends an email when an connection has been accepted. I looked into reading log files and got this so far
Code:
LOG=/var/adm/sqllog
while true
do
tail -100 $LOG | grep "ORA" > /dev/null
[code]....
got a textfile with : as delimiters in between fields. e.g.1:2:3:4:5:6Thomas Cruise:Johnavid:Peter:Betty:JaneThe names may or may not contain white spaces.I am required to substitute any one of these names in the file with a new one inputted by user.e.g. to change John to Johnny, David to Beckham, etc. without touching any of the other names in the same line. Just one at a time.So here's the sed expression I was trying out with:
sed -i "s/<(.:.:)David>/$1Beckham/" names.txt
I also tried:
sed -i "s/<(.*)David>/<1Beckham>/" names.txt
[code]....
I was reading about Ruby code blocks, but it's all a bit hazy.My questions:1. Can you store executable code in the value part of a hash (err...associative array)2. If you did, how would you call the code?3. If you executed this stored code, would it be possible when doing soto pass in an object to the code that it could use?
View 1 Replies View RelatedWhat is the Terminology called of a Binary using a file that is not part of it's self? An example would be when a browser uses a HTML file for it's interface. The binaries code has to know how to find it and so on. I imagine that the applications binary uses a system call and that another application takes over.
View 1 Replies View RelatedI have a single directory of pairs of files, with the pairs sharing a string as the beginning of the filename:
SF1-27F1492R-clone01_T3_A18_001.ab1
SF1-27F1492R-clone01_T7_A20_002.ab1
SF1-27F1492R-clone02_T3_A19_003.ab1
SF1-27F1492R-clone02_T7_A21_004.ab1
...etc
I need to create a subdirectory for each pair then move the pair into the subdirectory.
I accomplished the first step using:
$find /foo -name '*T3*' -exec mkdir '{}.wrk' ;
I can use a regex to designate the pair and associate the directory, but how do I use regex in a path as the output of a move command?
My rquirement is I have a flat file with lot of lines on it.example:
line1
line2
line3
[code]....
In a file,
I need to remove a part of string: /o
string:
or
the string can be
here I need to remove /d2
So, I need to remove everything after when I get last /
Probably a stupid sounding question, but bear with me please. I need to use the link grammar parser in order to do some part of speech tagging. It's freely available and works once you run the makefile or 'make' it or however it's correctly said. Thing is, it has a C API which I intend to use. And once I ran a bit of the sample code given in the documentation it gave a whole host of errors. This is very confusing because I'm including the path for the folder that has all the header files.
gcc -I/path/include/ filename.c. But it still gives me errors about not being able to find things that are clearly defined there. An hour of trudging around the internet tells me I need to 'compile' the API first. I'm not exactly sure how or if I'm supposed to do that. If someone could just shed light on this it would be greatly appreciated. I grow increasingly cynical to the musical swell of my tiny brain rattling in my skull.
I am trying to create a shell script, on taking a input file as parameter, which need to do 3 things
1) create a copy of existing file.
2) add a new line to the copied file.
3) strip off all the absolute paths inside the copied file
The first 2 points are straight forward. but i am finding it difficult to acheive the 3rd point. myself not very good with awk and sed. but gave it a shot in vain. For example, the input script consists of below,
PROGRAM=`/usr/bin/basename $0`
HOST=`/usr/bin/uname -n`
echo Start $PROGRAM `/usr/bin/date` |
/usr/bin/tee -a $LOG
The output of the script should look like,
PROGRAM=`basename $0`
HOST=`uname -n`
echo Start $PROGRAM `date` |
tee -a $LOG
I recently moved into a place where I have no control over (or access to) the modem or router, and I've encountered quite an annoying problem. My Internet connection keeps cutting out, not for long periods of time, but just enough time to stop videos from buffering and web pages from loading, and it happens often enough to become a regular thing.
I know there are ways to fix this problem, but unfortunately I'm in a position where I can't. So my question is; are there any external "fixes" I can do to keep the Internet connection alive or to retry connecting every time it fails? Like perhaps a Firefox addon or something I can install?
Using konsole it keeps cutting off half the screen when using vim or less, see screenshot SUSE Paste
Anyone seen this before and now how to stop it?
I've been looking around for a Linux variant which will install only the software I need rather than everything Ubuntu (for example) puts in by default. This is to create a virtual machine in Virtualbox which has bash, apache, python, perl, SQLite, openssh and a few other programs but nothing else. I'd prefer to go with Ubuntu if possible but another modern distro would do as well (I like using apt-get and yum rather than downloading/compiling etc).
SuseStudio.com, which is probably the best so far.Ubuntu 9.10, by pressing F4 to get the boot options on the install disc, but there is no minimal installation (oops! had the alternate disc instead of the server disc).Arch Linux, slightly confusing install procedure but I might go back and try again.Gentoo, started well but fairly soon the HD on the virtual machine went to 2Gb, even before the installation had started in earnest (I'd partitioned the disks is all).I realise there are various "small" Linuxes around like Puppy, Feather, DSL, etc, but they seem to be aimed at desktop users or as a techie's toolkit, and I want a small-as-possible server distro which can be managed with tools like apt or yum or similar.
I'm just looking for a good mpeg cutter for my Ubuntu laptop. I currently use video redo on my Windows PC but that is also my HTPC and is hooked up to the TV. I would prefer not to do it on the TV because of possible burn in issues and would love to be able to take the mpeg files recorded on the HTPC and cut them on the laptop but haven't found a really great application to do that.
View 1 Replies View RelatedJudging by the number of responses (close to zero) to other threads about powertop on this forum, I have little hope in getting any answers. However, I do not know where else could I ask. PowerTop tell me that even after applying almost all the tips and tricks from lesswatts.org, my laptop still consumes over 72 Watts while idling.
Code:
< Detailed C-state information is not P-states (frequencies)
1.60 Ghz 0.0%
800 Mhz 100.0%
Wakeups-from-idle per second : 451.1 interval: 10.0s
Power usage (5 minute ACPI estimate) : 72.5 W (0.3 hours left)
Top causes for wakeups:
[Code]...
Suggestion: Enable USB autosuspend by pressing the U key or adding usbcore.autosuspend=1 to the kernel command line in the grub config This is when I am not touching the laptop. When I am surfing the web or listen to music, it goes up to 2000+ wakeups! How do I cut it further? I am getting like 20-30 minutes max on battery and this is unacceptable cause in Windows I get at least 3 times that.
I've had this problem for a while and wondering if anyone has an idea what is going on.
I'm running 9.10 on a computer at home, and when I VNC into it from my Mac at work.
When I do a right-click copy or ctrl-c, the vnc will crash and won't connect again. I can reach the computer with SSH and reboot, but it's kind of annoying when it does this. Has anyone seen this before and is there a fix?
When I vuse client or torrent my connection to internet gets unstable.
View 5 Replies View Related