string comparing in C


 
Thread Tools Search this Thread
Top Forums Programming string comparing in C
# 1  
Old 04-06-2011
string comparing in C

Hello,
I need help with a program I'm trying to write for my moms science class, what it has to do is accept a user inputed string and search for it in a text file (file contains all the elements)

The file looks like:

H Hydrogen 1
He Helium 2
Li Lithium 3
Be Beryllium 4
...

If the input string (element abbv.) is found printf the element and atomic number
(not homework)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing string's with space

How can i comparing string's whith blank spaces? I have this problem: DIF1="STRING 1212" DIF2="STRING 1212" if then echo "Differents" else echo "Equals" fi Error: 1212}: unknown test operator (3 Replies)
Discussion started by: Xedrox
3 Replies

2. UNIX for Advanced & Expert Users

Help comparing string, please

Good morning, I need compare this string. if || || ; then But this line not work, somebody can say me what is the error. Thank you for advanced. (5 Replies)
Discussion started by: systemoper
5 Replies

3. Shell Programming and Scripting

How to append a string by comparing another string?

Hi , I have one file like BUD,BDL BUDCAR BUD,BDL BUDLAMP ABC,CDF,KLT ABISKAR ABC,CDF,KLT CORNEL ABC,CDF,KLT KANNAD JKL,HNM,KTY,KJY JAGAN JKL,HNM,KTY,KJY HOUSE JKL,HNM,KTY,KJY KATAK JKL,HNM,KTY,KJY KOLKA The o/p should be like BUD,BDL BUDCAR,BUDLAMP ABC,CDF,KLT... (4 Replies)
Discussion started by: jagdishrout
4 Replies

4. Shell Programming and Scripting

Comparing a command with a string

Is this possible? If so it seems like a very easy and short script.I'd like to make a script that will print a friendly message but only if it is on your personal terminal. so the code would look like this: #!/bin/csh if ; then echo "This is a friendly message :D "; fi thats what i have... (4 Replies)
Discussion started by: Waffles
4 Replies

5. UNIX for Dummies Questions & Answers

Comparing a String variable with a string literal in a Debian shell script

Hi All, I am trying to to compare a string variable with a string literal inside a loop but keep getting the ./testifstructure.sh: line 6: #!/bin/sh BOOK_LIST="BOOK1 BOOK2" for BOOK in ${BOOK_LIST} do if then echo '1' else echo '2' fi done Please use next... (1 Reply)
Discussion started by: daveu7
1 Replies

6. Shell Programming and Scripting

comparing variables to date as string

I have a file $ cat myfile A 02/16/2012 B 02/19/2012 C 02/20/2012 D 02/17/2012 E 02/16/2012 My simple script > cat myscript.sh mydate="02/16/2012" awk ' ($2~/$mydate/) {print $1}' < myfile but I got no output! and when I try $2~/'$mydate'/ I got: The error context is (2 Replies)
Discussion started by: Sara_84
2 Replies

7. Shell Programming and Scripting

Problem in comparing 2 files string by string

Hi Champs, I am a newbie to unix world, and I am trying to built a script which seems to be far tough to be done alone by me..... " I am having a raw csv file which contains around 50 fields..." From that file I have to grep 2 fields "A" and "B"....field "A" is to be aligned vertically... (11 Replies)
Discussion started by: jitendra.pat04
11 Replies

8. Programming

string comparing in C

Hello, I need help with a program I'm trying to write for my moms science class, what it has to do is accept a user inputed string and search for it in a text file (file contains all the elements) The file looks like: H Hydrogen 1 He Helium 2 Li Lithium 3 Be Beryllium 4 ... If the... (1 Reply)
Discussion started by: duvalC
1 Replies

9. Shell Programming and Scripting

Comparing a variable to a string

Hi, I am trying to write a script to show the status of a Network card. Variables: chosennic is a read variable statuss=`/sbin/ifconfig $chosennic | grep MTU | awk '{print $1}'` ipadd=`/sbin/ifconfig $chosennic | grep Bcast | awk '{print $2}' | awk -F : '{print $2}'`... (2 Replies)
Discussion started by: mikejreading
2 Replies

10. Shell Programming and Scripting

Comparing string and integer in IF

hi, I need to create an IF condition. I read a line from a file and get the 5 word using space as a delimited. This word can have only two values either '*' or '1-5' I need to write an IF condition for two cases. I can either compare it to * or 1-5(or even 1 by cutting and getting only the... (3 Replies)
Discussion started by: kaushys
3 Replies
Login or Register to Ask a Question
BIORUBY(1)						      General Commands Manual							BIORUBY(1)

NAME
br_pmfetch -- PubMed Client SYNOPSIS
br_pmfetch [options...] ["query string"] br_pmfetch [--query"query string"] [other options...] DESCRIPTION
This manual page documents briefly the br_pmfetch. br_pmfetch is a command line program to query PubMed. It can take a variety of options (documented below) to restrict your search query, which is specified by the query string. OPTIONS
-q --query Query string for PubMed search. -t --title Title of the article to search. -j --journal Journal title to search. -v --volume Journal volume to search. -i --issue Journal issue to search. -p --page First page number of the article to search. -a --author Author name to search. -m --mesh MeSH term to search. -f --format Summary output format. Options are endnote, medline, bibitem, bibtex, report, abstract nature, science, genome_res, genome_biol, nar, current, trends, cell. --pmidlist Output only a list of PudMed IDs. -n --retmax Number of articles to retrieve at the maximum. -N --retstart Starting number of articles to retrieve. -s --sort Sort method for the summary output. Options are author, journal, pub+date. --reldate Search articles published within recent # of days. --mindate Search articles published after the date YYYY/MM/DD. --maxdate Search articles published before the date YYYY/MM/DD. --help Output help and then exit. --examples Output example usages and then exit. --version Output version number and then exit. SEE ALSO
The following pages have information on the PubMed search options: http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html http://www.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html AUTHOR
This manual page was written by David Nusinow dnusinow@debian.org for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. BIORUBY(1)