LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2009, 02:39 AM   #16
ibabhelix
Member
 
Registered: Sep 2009
Posts: 51

Original Poster
Rep: Reputation: 18

@ghostdog74 - thank you so much

the code u have written what is it called ? how do i learn it ?
 
Old 10-23-2009, 03:02 AM   #17
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
it's called shell script, like you asked for.
 
Old 10-23-2009, 03:44 AM   #18
ibabhelix
Member
 
Registered: Sep 2009
Posts: 51

Original Poster
Rep: Reputation: 18
oh okay ,

like in other progrmming languages is there a command to search for a particular string ?

like if suppose i have two lines
Code:
ATOM    902  C4'   C A  29      
ATOM      3  C4'   G A   1
like this and they have C4' in the same position, when such lines come continuously i want to add a empty line between them, how do i do that ?

i want it like this
Code:
ATOM    902  C4'   C A  29      
 
ATOM      3  C4'   G A   1
please dont think i'am asking everything here and not trying myself, i am trying to learn, but i need help.

could anyone please tel me how to do this ?
please
 
Old 11-02-2009, 12:28 AM   #19
ibabhelix
Member
 
Registered: Sep 2009
Posts: 51

Original Poster
Rep: Reputation: 18
...

Last edited by ibabhelix; 11-02-2009 at 04:47 AM.
 
Old 11-02-2009, 01:42 AM   #20
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Earlier in this thread you were given some reading suggestions. I asked if you had read them, but no answer.

So now please tell us what you have read......

Quote:
like in other progrmming languages is there a command to search for a particular string ?
MANY....You are using 2 of them in the code above.
 
Old 11-02-2009, 04:27 AM   #21
ibabhelix
Member
 
Registered: Sep 2009
Posts: 51

Original Poster
Rep: Reputation: 18
hey i have a doubt, suppose in the script i include an exe type of file for ex. ./a.out, which takes input as a pdb file namely 1sn3.pdb, now i want my output text file to contain the name 1sn3.txt , how do i do that using the shell script ???
is there any method ???? or any command ???

please let me know
 
Old 11-02-2009, 04:29 AM   #22
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well that depends what on earth the program is doing with the input doesn't it?? If you mean that you need to provide an output filename on the command line, then as everm there are dozens of ways, like using "basename" to remove the main suffix from the variable and adding your own to the shorter string.

Last edited by acid_kewpie; 11-02-2009 at 04:30 AM.
 
Old 11-02-2009, 04:33 AM   #23
ibabhelix
Member
 
Registered: Sep 2009
Posts: 51

Original Poster
Rep: Reputation: 18
ok its like this :

Code:
./a.out
clear
cut -c 13-28 *.pdb > prt1t
exec 6<"prt1t" # assign file descriptor 6 to file1

while read  a <&6 # read a line from file1
do
    read  b <&6 # read the 2nd line from file1
    echo "$a" >> prt1  # print both lines from file1
    echo "$b" >> prt1
    echo "$b" >> prt1

done
exec >&6

sed '1,2d' prt1 > prt2
paste prt1 prt2 a6.txt > ans1t
awk '{ if($9 != "") print $0 }' ans1t > ans1
 
rm prt1t prt1 prt2 a6.txt b6.txt c6.txt ans1t
here for the ./a.out , will ask for a file name and if i give tat as 1sn3.pdb, then i want ans1 to be 1sn3.

the input file which is 1sn3.pdb in this case can be any pdb file.like 1ds4.pdb or 4hgf.pdb
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Shell Scripting latinmusic74 Linux - Newbie 13 09-27-2008 03:27 PM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
Linux Shell Scripting yaadhav Linux - Newbie 4 08-20-2005 04:05 PM
Linux Shell Scripting Help RowanB Programming 13 11-12-2004 05:07 PM


All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration