Programming :: Unique The Content Within A String With Seperator?

May 17, 2011

I am green on linux script. I would like to perform the following operation:String a: 1,2,3,2,4,How to unique this string to become: 1,2,3,4,?

View 3 Replies


ADVERTISEMENT

General :: Deleting First Line With Unique String Then All Subsequent Lines Thereafter?

Jan 20, 2011

I am doing molecular dynamics where I have to edit files. I have looked at tutorials for grep and sed but can't find my solution. The files produced in my simulations look something like this:

ATOM 1825 NE2 GLN 112 113.646 27.895 14.456
ATOM 1826 HE21 GLN 112 114.020 26.957 14.490
ATOM 1827 HE22 GLN 112 112.649 28.039 14.388

[code]...

View 5 Replies View Related

Programming :: Copy String A To String B And Change String B With Toupper() And Count The Chars?

Oct 22, 2010

copy string a to string b and change string b with toupper() and count the chars

View 3 Replies View Related

Software :: Make Licensing Software - Find Unique Identifiable String For A Machine That User Cannot Change?

Jan 19, 2011

I want to make licencing software. For that first i am retrieving hdd serial no, nic mac address. But the prob is, what if someone changes/replicates its hdd serial no or mac address ? Many softwares are available to do so, in market. How can I find some unique identifiable string for a machine that user can not change?

View 3 Replies View Related

Programming :: Pthread - Take String From The Command Line And Creates A Thread To Print The String

May 3, 2011

I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.

[Code]....

One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?

Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.

View 6 Replies View Related

Programming :: Symbolic Links Permissions Unique

Feb 20, 2011

Is it possible to change permissions on symbolic links using the c programming language or any other for that matter? Now, I know what you are thinking, so let me provide some background.I know permission are meaningless. I know that typically permissions are set to 777.The project that I am working on does the following. On HPUX systems, a c binary recreates missing links from a stored image of the filesystem, if they are missing. The problem is that the permissions are 700 when the links are restored (should be 777). The c method to restore the symbolic links is "symlink()" which takes as its argument the target and linkname.The client wants 777 on the links. I do not know why the permissions are different. I would like to know if I can change permissions on the link by code, changing the mode?

Is this a bug somewhere in HPUX 10,x and 11.x os or "symlink" c library method, who knows?There are groups of nodes running HPUX, for example groupA, groupB etc.The problems appears in groupA but not in groupB. Seems the nodes are configured differently.While I would love to know if this is a configuration issue, it appears that way to me, there would be little I could do about it. Politics you know, but that's okay, in time someone would listen.

View 3 Replies View Related

Programming :: Using Sed Replace Line Containing Particular String By A Single String?

Oct 16, 2010

I have a set of lines as ahown below:

Leon went to school
Leon came back from school..
Leon had dinner...

I have to replace the line containing "dinner" by a single string LUNCH...

View 2 Replies View Related

Programming :: Creates String Suffixes Out Of A Reference String?

Feb 25, 2011

I need to creates string suffixes out of a Reference string. for eg. suffixes of abcdefg will be

1)bcdefg
2)cdefg
3)defg
and so on...

create an array of pointers to point to the first few characters and then use that pointer to print the rest of the string.But when i print using the pointer i get GARBAGE values! shudn't std::cout<<ptr[w] print the string following the char it is pointing to? why do i get garbage values?

View 9 Replies View Related

Programming :: C - Put A Specific Arbitrary Part Of A String Into It's Own String?

Apr 18, 2010

So if I'm given a location of a file like:

How can I just take the type of the file at the end? I know I can use strrchr() for a period to get the pointer to the period just before file type. Is there a build in string function that will just take the rest of the string from a certain point on forward in the string? I know it wouldn't be much work to make it myself, but I figured I would find out if it already existed before doing it.

View 9 Replies View Related

Programming :: Convert String To Integer Back To String C++ ?

Mar 13, 2010

Code:

The error is:

Code:

What I want to do is take input of ip4 as a string, convert it to an integer to add 1 to it, then reconvert it back to a string. Its not working.

My full code is:

Code:

View 1 Replies View Related

Programming :: Create Unique Multithread Algorithms For Every Particular Program?

Aug 6, 2010

Since 2005 when DualCore CPUs came out, you need to create unique multithread algorithms for every particular program? Or you have patterns?

View 4 Replies View Related

Programming :: Assigning Custom String To Std::string In C++?

Oct 12, 2009

I've been given a custom-made string class which handles string, wstring and bstr. It has a number of methods and assignment operators to convert to and from different types. The app I work on compiles happily in VS6 and VS2008, but when trying to compile in Redhat (version 4.1.1 in Redhat 5.0)

[code]....

View 4 Replies View Related

Programming :: How To Check If All Letters Of One String Are In Another String?

Nov 11, 2010

I have the following two type of strings1: A/D2: A/C/DI am trying to write a subroutine to check whether all of the letters in string 1 appears in string 2. If yes, return true. If not, return false. In the above example, all the letters (A and D) in string 1 are also present in string 2, so I return true.

View 4 Replies View Related

Programming :: Updating A Sequence Of Datetimes In Fields With Unique Contrains

Mar 14, 2010

I am faced with the following problem; I need to update all fields of type datetime without ... with the following sort data:01-01-2010 12:10:30.256 - this is just an example.these fields are restricted with a unique constrained. My question is how can I generate the above sort data, especially the last three numbers with leading point. After that how can I update a table with existing data with this newly generated data so that the fields really do carry unique data.As you probably can read out of my question, I read through the help in pgAdmin and came as far as generating date, maybe datetime but not the .123 number. And a little insert script I found in the help, that I modified as UPDATE resulted in updating only the last generated data in all required fields.

View 7 Replies View Related

Programming :: Multiple Input Into Seq Command From Pipe - Single Column Unique Numbers

May 13, 2011

Have this script which is reading in a series of files, one at a time with while-do-done loop, each file goes through various greps/awk's where this info is then saved to various files for later use. i.e....

Script is being run on Linux Red Hat,

In one of the grep/awk's the output (currently) are 2 columns (min max), i.e....| awk '{print $1, $2}' | sort -u which outputs (e.g.)

The number of "min max" pairs varies from file to file. Want to output a single column of unique numbers from the min max pairs & get the number of them for input to a file...i.e...

Where <PROCESS> is some process/technique that will generate a single column of integers (increment of 1) to pipe into the next one (sort -u)

i.e. (example from above)

Have tried command seq - only works for single pair input i.e.

Is there any command like seq etc which will output a single column based on a input of min max numbers (increment 1) to pipe onwards to next command?

View 4 Replies View Related

General :: Removing Specific Field Seperator To Combine Two Fields?

Dec 2, 2010

I am trying to remove the space between the 2nd and 3rd fields but just cannot work out how to do it. I've considered sed, cut, awk...I know with sed you can replace all instances within a file but can you also specify to remove, say, the 2nd instance of a space in each line (this would be perfect for me)?

DAAE 60 402 Bejaia Algeria 1 36-43N 005-04E 36-43N 005-04E 2 2 P
DAAG 60 390 Dar-El-Beida Algeria 1 36-43N 003-15E 36-43N 003-15E 25 25 P
DAAJ 60 670 Djanet Algeria 1 24-33N 009-28E 24-33N 009-28E 1054 1054 P

[code]...

View 3 Replies View Related

Programming :: Convert The Int To A String Using Stringstream Then Convert The String To A Char?

Mar 26, 2011

Do I have the convert the int to a string using stringstream then convert the string to a char? or is there a more direct way?Also is there a way to tell the length of a int?

View 5 Replies View Related

Programming :: Read Content From Net In Python?

Jan 7, 2011

i made a program to read from a specific site whats on tv in that day.My question is if some of you have an idee how can i figure it out,what are movies,what are sports,what are shows ?

View 3 Replies View Related

Programming :: Serial Port Programming String?

Nov 24, 2010

I have a serial port program which is reading a string .if(read(readfd,sResult,1)>0)where sResult is unsigned char sResult[10];if sResult is array of 10 then iam getting string perfectly but if iam making sResult only as unsigned char I am getting NULL value CODE BELOW

Code:
unsigned char sResult;
main()
{
readfd = open("/dev/ttyUSB0", O_RDONLY);
if (readfd == -1)
{
perror("READ: open_port: Unable to open /dev/ttyUSB0-

[Code]...

View 2 Replies View Related

Programming :: C - Can't Print In Screen The Content Of File

Mar 20, 2010

why this code can't print in the while loop the content of the file ?

Code:

#include <stdio.h>
int main()
{
FILE *fp;

[code]...

View 7 Replies View Related

Programming :: (PHP) Dynamic Or Static Content Generation

May 12, 2011

My project looks like this:

Home
The Team [no-page]
-X
-Y
-Z
Projects [no-page]
-Coding [no-page]
--A
--B
--C
-Desing [no-page]
--E
--F
-Security [no-page]
--G
--H

Note: the Code/Design/Security projects pages (A,B,C,D...) will be at start around 35 pages, and will grow. My index.php is something like this:
PHP Code: .....

What I would like to know is how to build the content (the home-main.php)? Do it dynamically based on a link something like this index.php?page=coding_b, and put in the index.php page a number of 35 if/else statements to cover all the project pages or ... static, creating every page for the projects menu when I create the menu? I check if a page 'pro-co-a.php' exists, if not I create it based on some template and do the query to get the content from db or? How to organize the pages, if using static page?

View 5 Replies View Related

Programming :: Can't Access To Content Of Array In For Loop

Mar 7, 2010

When I deal with an array in a function I con not access to the content of array in a for loop, but out of a for loop I can access to them! for example

[code]...

In a function when I send as parameter, in a for loop it prints the content of array and out of a for loop it prints the address of arr[i]

View 5 Replies View Related

Programming :: Display Content Of Txt File In Xbmc?

Apr 25, 2011

go about developing this add-on. i am testing this on my xbmc-live set-up; i am fairly affluent in bash/ c but unfortunately i dont have experience with python.i trimmed the data using this bash 1-liner so the output looks like:

Code:
xbmc@XBMCLive:~$ wget -q --output-document=- www.google.com/movies | sed -n 3p | tr '<' "
" | egrep "(title_bar|id=link_1_theater|class=info|mid=|Rated|class=times|fandango)" | grep

[code]...

View 2 Replies View Related

Programming :: Use Echo To Display The Content Of A Variable?

Jan 4, 2010

I have a problem to use echo to display the content of a variable.

This is what I do:

Code:
#!/bin/bash
USAGE="Usage: name [OPTIONS] [DIRECTORIES]"
echo $USAGE

When I run this little script I get the following output:

Usage: name [OPTIONS] R

So I think that [DI might be some sort of escape sequence. But I do not know how to unescape it. Does anyone have a hint for me?

View 14 Replies View Related

General :: Find Will Go Through The Content Of Tarball As Well And List All Content

Oct 5, 2010

I am using find to search for .tgz files modified more than 7 days ago and delete them.find /directory/ -iname backup*.tgz -daystart -mtime +7 -exec rm -rf {} My problem is that find will go through the content of tarball as well and list all content. I want to only search main tarball and delete it if older than 7 days.

View 4 Replies View Related

Programming :: Iterate The Content Of A File In The Shell Script?

May 29, 2010

i need to check group of URLs and there https requests from browser. Recently i got some command line web browsers to know the HTTPS status of the URL like curl, wget etc... Now all of i need to do is write a shell script. I will put all my URLs in a text file and my shell script should read each URL one by one and log the status along with the corresponding URL.

Sample output:

./myscript.sh url.txt
1. site - 200 OK

View 6 Replies View Related

Programming :: Grabbing Window Content Requires Drawable

Apr 9, 2010

I'd like to write a C/C++ program, that would grab content of window (in form of pixmap), which belongs to another application and do something with it. However, I ran into problems already at the beginning. In all toolkits I have searched through, I only found one function that claims to do what I want, namely XGetImage from Xlib. However, among other parameters like Display, coordinates, etc., it requires a Drawable. How do I specify a Drawable, that would correspond to the window I want to grab content of? Is there any easier way to achieve this?

View 2 Replies View Related

Programming :: Printing HTML Content As Plain Text?

Sep 16, 2009

My code perl code is as below.I want to print the contents of file "/dir/Myfile".But problem is that the file "Myfile" contains html content as below.

<TP_INFO> <Mail> </Mail> </TP_INFO>

So the IE treats it as HTML content and doesnt print the content present in the tags.Can any one help me to print HTML content as plain text?

sub PrintLog
{
print "Content-Type: text/plain
";

[code]....

View 4 Replies View Related

Programming :: Remove Many Lines Based On Content Of Other File

Jun 21, 2011

I a csv-file (A.csv) with a total of 4.600.000 lines. Thats to many and only a few is necessary. I have a txt-file with 150 lines (X.txt) (all lines is dataset from a mainframe and looks like abc.def.123.456. How do I remove lines from A.csv where none of the dataset from x.txt is present?

View 13 Replies View Related

Programming :: HUGE Files - Compare A List Of Patterns From One File And Grep Them Against Another File And Print Out Only The Unique Patterns?

Aug 13, 2010

I am trying to compare a list of patterns from one file and grep them against another file and print out only the unique patterns. Unfortunately these files are so large that they have yet to run to completion. Here's the command that I used:

Code: grep -L -f file_one.txt file_two.txt > output.output Here's some example data:

Code:
>FQ4HLCS01BMR4N
>FQ4HLCS01BZNV6
>FQ4HLCS01B40PB
>FQ4HLCS01BT43K
>FQ4HLCS01CB736
>FQ4HLCS01BU3UM
>FQ4HLCS01BBIFQ

how to increase efficiency or use another command?

View 14 Replies View Related







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