Programming :: Shell Scripts For Cutting And Pasting Part Of Data?

Mar 17, 2011

I have a tab-delimited txt file as below. It is part of the original file.Quote:

##Hello
##Welcome
#C1 C2 C3

[code]....

View 13 Replies


ADVERTISEMENT

Programming :: Cutting Last Part Of URL?

Dec 1, 2010

website.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 Replies View Related

Ubuntu Networking :: VNC Crashes And Won't Connect Again When Cutting And Pasting / Fix It?

Apr 8, 2010

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?

View 6 Replies View Related

Programming :: Run A Part Of Code On Exit In A Shell Script?

May 14, 2010

How 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]...

View 2 Replies View Related

Programming :: Extract A Part Of Flat File In Shell Script?

Feb 12, 2010

My rquirement is I have a flat file with lot of lines on it.example:

line1
line2
line3

[code]....

View 8 Replies View Related

Programming :: Shell Script To Delete Part Text Of A Line If Pattern Matches?

Apr 12, 2010

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

View 14 Replies View Related

Programming :: Checking Shell Script Variable Contain Numeric Data

Mar 28, 2009

I need to check whether a shell script variable contains non-zero numeric data to proceed. The variable should contain numeric values, but may in fact contain zeroes, blank space or nothing. So far, I have tried various combinations of:

Code:
if test $variable
then
if test $variable -gt 0
then
echo "good data exists"
else "no good data exists"
fi
fi
It partially works, but I get either "too many arguments" or "integer expression expected".

View 2 Replies View Related

Programming :: Implement (linear Data Structure) Queue In Shell Script?

Jun 21, 2010

I am in deeply need of queue (linear data structure) in shell script. How can I implement this ??

View 2 Replies View Related

Programming :: Shell Script Network Data Collection Anomaly- Workarounds/changes?

Jun 5, 2010

I have a script that I am using to try to measure network throughput over the ethernet ports. This is at work in order to test the performance of our onboard ethernet ports (planar) versus our pci-e (and daughter) ethernet pluggable cards.The script is very long (and calls other scripts), so I will try to only show the parts that seem to be producing this weird little bug:

Code:
#Robert de Bock's "A shell script to measure network
#throughput on Linux machines" served as the basis for
#this part of the script. Thank you for your help Robert!

[code]...

View 4 Replies View Related

Programming :: Writing Shell Snip To Import CSV Data Into Bash Array

Jan 5, 2011

I have been trying to write a simple snip of bash shell code to import from 1 to 100 records into a Bash array.

I have a CSV file that is structured like:
record1,item1,item2,item3,item4
record2,item1,item2,item3,item4
record3,item1,item2,item3,item4
record4,item1,item2,item3,item4

And would like to get this data into corresponding arrays as such:
$record1[item1-4]
$record2[item1-4]
$record3[item1-4]
$record4[item1-4]

View 9 Replies View Related

Programming :: Cutting An Html File Apart - Perl - Sed - Awk?

Apr 13, 2010

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.

View 4 Replies View Related

Programming :: Pasting A Png Image On Another Through CAIRO Library?

Mar 3, 2010

I could easily paste images on each other in Python through PIL (Python Imaging Library)
Now I need to use Cairo with C++ for the above purpose.I have referred the following but couldn't ge

View 5 Replies View Related

Programming :: Pasting Multiple Cut Outputs To A Tab Delimited Output File?

Sep 4, 2010

I have a requirement like this:Cut the characters from each line of a file with following positions: 21-24, 25-34 ,111-120.Thse fields now need to be placed in a tab delimited output file.Currently this is how I am achieving it:

#!/bin/sh
cat newsmaple.txt | cut -c 21-24 > out1.txt
cat newsmaple.txt | cut -c 25-34 >out2.txt

[code]....

View 1 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Ubuntu Installation :: After Dd From Full 15GB Part To 1.3TB Part, Shows Same Free Space?

Dec 8, 2010

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 Related

Programming :: Counter As Part Of Variablename In C?

Oct 24, 2010

is it possible in C to use a counter as part of a variable name?

View 2 Replies View Related

Programming :: Extract Part Of File Name?

Mar 26, 2010

I 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 Related

Programming :: Replace Part Of A File With Another?

Jan 8, 2010

There 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 Related

Programming :: Transposing Only Part Of Row Into Column?

Jul 8, 2011

I 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?

View 1 Replies View Related

Server :: How To Access Local Part / Domain Part Of Email Address In Postfix's Main.cf?

May 24, 2010

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 Related

Programming :: Get Data From Serial Port Function Read() Blocks When Data Not Available?

Jun 11, 2009

I am using read() in c++ to get data from a serial port. However, if no data is available on the serial port the function blocks until dta arrives.Example code:

//------------------------------------------------------------
char m_readBuffer[255] = {0};
char* p_curChar = m_readBuffer;

[code]...

View 1 Replies View Related

Software :: Server Hosting Different Part Of Web Site Must Appear As Part Of Domain

Jul 13, 2009

we 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 Related

Programming :: Check If A Part Of String Exist

Sep 27, 2010

I 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++?

View 5 Replies View Related

Hardware :: Is CMOSRAM Is Part On Mother Board Or Part Of RAM?

Jan 14, 2010

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 Related

Programming :: Data Directory In Automake - Data Is Always Read-only ?

May 9, 2010

I have some data files that should be distributed with my program. Using dist_pkgdata_DATA in Makefile.am, I get these files installed to /usr/local/data/share/package-name. The problem is that data is read-only, and my program needs to modify it. Playing with dist_sharedstate_DATA, dist_localstate_DATA, dist-data_DATA varibles, I got different installation directories, like /usr/local/com, usr/local/var, but data is always read-only.

How can I distribute modifiable data files with my package? I need some common directory for all users, or maybe local data in a user directory.

View 1 Replies View Related

Programming :: Implement Some Part Of Codes To Use The GPU Of Graphic Card?

Sep 25, 2010

I 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 Related

Programming :: Script That Takes A Part Of A Log File And Emails It?

Mar 22, 2011

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]....

View 10 Replies View Related

Programming :: Mistake With Sed Espression Is Saving Part Of Pattern?

Jan 20, 2010

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]....

View 24 Replies View Related

Programming :: Store Executable Code In The Value Part Of A Hash?

May 28, 2010

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 Related







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