Sponsored Content
Top Forums Shell Programming and Scripting Multiple input and save in windows format Post 302938852 by cmccabe on Thursday 19th of March 2015 01:53:27 PM
Old 03-19-2015
Multiple input and save in windows format

The below code works great if the user inputs a single value. The sed command applies the NM_ with the user input it is saved to a file. However, if two values are entered the below does not work. Can both values be saved at the same time if they are entered in windows format? Thank you Smilie.

Code:
 gjb2() {
    printf "\n\n"
    printf "What is the id of the patient getting GJB2 analysis  : "; read id
    printf "Enter variant(s): "; read variant
	
	[ -z "$id" ] && printf "\n No ID supplied. Leaving match function." && sleep 2 && return
    [ "$id" = "end" ] && printf "\n Leaving match function." && sleep 2 && return
	
	# save file in windows python directory
    printf "%s\n" "$variant" > c:/Users/cmccabe/Desktop/Python27/$id.txt
	
	# add transcript
	sed -i '$a NM_004004.5:' c:/Users/cmccabe/Desktop/Python27/$id.txt
    printf "NM_004004.5:%s\n" "$variant" > c:/Users/cmccabe/Desktop/Python27/$id.txt
	add2text ${id}.txt
	gjb2name
}

Maybe:
Code:
 awk 'NR!=FNR{print L[FNR],$0; next} $1=="variant"{I=$2}
    $1=="Name"{L[++p]=I FS $2}' $variant $variant > $id.txt

Code:
 user enters: c.74G>A

1 value output
NM_004004.5:c.74G>A

user enters:c.79G>A,c.283G>A

current 2 value output
NM_004004.5:c.74G>A,c.283G>A

Desired 2 value output
NM_004004.5:c.74G>A
NM_004004.5:c.283G>A


Last edited by cmccabe; 03-19-2015 at 02:59 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Save Excel file as .txt in UNIX format

I have some files created in Excel that have to be saved as .txt files in order to load them into our accounting system. I can save the files as .txt files through Excel, but I then have to open them in TextPad and do a save as to change the Format from PC to UNIX. Is there a way to skip this step... (2 Replies)
Discussion started by: jroyalty
2 Replies

2. Hardware

<power save [ input 1 ]>

hello on my ultra 5 (under debian) obp since I activated an error saving mode display. Since it starts and displays <power save >, then this is prologue to sleep for hours. i can ejecting the cdrom works, I hear the fans .... I have not access of OpenBoot (stop + a). can i do an hard... (0 Replies)
Discussion started by: philo_71
0 Replies

3. Shell Programming and Scripting

How to add data from 2 input files and save it in 1 output file

Hi, i have 2 input files which are file1.txt and file2.txt. I need to extract data from file1.txt and file2.txt and save it in file3.txt like example below:- File1.txt ID scrap1 Name scrap1 start 1 end 10 ID scrap2 Name scrap2 start 11 end ... (4 Replies)
Discussion started by: redse171
4 Replies

4. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

5. Shell Programming and Scripting

Open Text file input data and save it.

Hi Guys, I have blank file A.txt I will run the script xyz.sh First i want to open a.txt file... Now i will enter some data like XYZ ABC PQR .. Save it and keep continue my script.... END of my script. Thanks (1 Reply)
Discussion started by: asavaliya
1 Replies

6. Shell Programming and Scripting

Get the input from user and save it as .txt file

Hi friends, I am pretty new to shell scripting, please help me in this Scenario. for example, If I have one file called input.txt once I run the script, 1.It has to delete the old input.txt and create the new input.txt (if old input.txt is not there, no offence, just it has to create a... (2 Replies)
Discussion started by: Padmanabhan
2 Replies

7. Shell Programming and Scripting

Save input as text in directory

I am having a little trouble with some things using the code below: 1. printf "Enter variant: "; read variant The user enters the variant and that value is used in the python script. However, I am not sure how to save that value inputed as a text file in a specific directory... (8 Replies)
Discussion started by: cmccabe
8 Replies

8. Shell Programming and Scripting

Input password to bash script, save, and enter when needed

I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed. #!/usr/bin/expect -f... (2 Replies)
Discussion started by: jbrass
2 Replies

9. Shell Programming and Scripting

How to save a file directly into windows from UNIX?

Hi, How can i save a file directly into my windows file system by running a shell script from my unix file system. I need to fetch data from a database and save it in a file. Since the data downloaded from database is huge, if i save it in the unix file system, the space in my home directory... (2 Replies)
Discussion started by: Little
2 Replies

10. UNIX for Beginners Questions & Answers

Seen Windows pc, having all the features of Linux, could exe, read and edit save like windows

Hi, totally new to linux base using windows when started learning and using computers. but i remember that one pc was there , look alike windows desktop, but could not do the task as windows just click and open and view edit etc. But, you could do a little differently even saving in and opening... (8 Replies)
Discussion started by: jraju
8 Replies
SHAPE_STDVAR(7) 					 Miscellaneous Information Manual					   SHAPE_STDVAR(7)

NAME
shape_stdvar - shapeTools RMS project wide variant definitions DESCRIPTION
This file contains common variant definitions to be used in a software development project supported by the shape release management sys- tem. The stdvar file defines a variant raster for a whole development project. This central definition facility unifies the naming and semantics of supported system variants. Stdvar is to be included into the Shapefiles of any part of the developed system via shape's include mechanism. The definitions in stdvar should be carefully designed and maintained for each supported project. They usually concern variant control for all hardware/operating system platforms to be supported or variant settings to produce different qualities of generated code (debug or optimized). Enclosed in the shapeTools distribution, you find the stdvar file used in the development of the shape toolkit itself. This may be a good starting point for developing an own variant raster. At least, it helps you learning the definition syntax. Otherwise, for a description on the syntax of variant definition parts see the shape(1) manual. FILES
$(SHAPELIBPATH)/stdvar SEE ALSO
shape_RMS(1), shape (1) 2.10.119 SHAPE_STDVAR(7)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy