how to capture a multi-line input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to capture a multi-line input
# 1  
Old 06-25-2009
how to capture a multi-line input

Hi
Does anybody know if there is a way to capture a multi-line input and output it to the file?
I was trying to use "read" for that but it only captures the first line....
I work in ksh...
Any advice? Thanks a lot
# 2  
Old 06-25-2009
A sample data file and a desired output, please (as always).
# 3  
Old 06-25-2009
And also what you have tried so far to accomplish your task (as always).
# 4  
Old 06-25-2009
The part of the script I am trying to write will promp the user to provide the input. Once the input is provided it needs to be send to the file for further processing. For example:
$ my_test_script
PROVIDE INPUT:

The use will copy and paste the following line from the "Word" document which will look something like that:

FMEMBIT_2.DTA FLAGS: 0 6 7 19 21 24 25 28 29 31
FMEMBIT_3.DTA FLAGS: 0 1 3 8 9 12 14 18 19 24 31
FMEMBIT_4.DTA FLAGS: 4 6 7 8 9 12 15 16 19 22 23 27

I need to capture those lines and output them to the file...
I am in ksh and was trying to use "read" but it captures only the first line....
Thanks a lot for any advice..... Cheers -A
# 5  
Old 06-25-2009
something like this ??

Code:
echo "enter the input"
while read LINE
do
echo $LINE >> op
if [ "$LINE" = "^A" ];then
break
fi
done

echo "other processing continues "

where you can consider ctrl-A as the terminator character.

Last edited by panyam; 06-25-2009 at 09:11 AM..
# 6  
Old 06-25-2009
Thanks a lot panyam! This is what i need....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Python Paramiko multi threading to capture all output for command applied in loop

My issue : I am getting only last command output data in ouput file. Though comamnd "print(output)" displays data for all 3rd column values but the data saved in file is not what required it hs to be the same which is being printed by command"print(output)". Could you please help me to fix this,... (0 Replies)
Discussion started by: as7951
0 Replies

2. Shell Programming and Scripting

Multi line log files to single line format

I want to read the log file which was generate from other command . And the output was having multi line in log files for job name and server name. But i need to make all the logs on one line Source file 07/15/2018 17:02:00 TRANSLOG_1700 Server0005_SQL ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

3. Shell Programming and Scripting

Help with reformat single-line multi-fasta into multi-line multi-fasta

Input File: >Seq1 ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD >Seq2 SDASDAQEQWEQeqAdfaasd >Seq3 ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG ...... Desired Output File >Seq1 ASDADAFASF ASFADGSDGF SDFSDFSDFS DFSDFSDFSD FSDFSDFSDF SD >Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies

4. Shell Programming and Scripting

Multi-line filtering based on multi-line pattern in a file

I have a file with data records separated by multiple equals signs, as below. ========== RECORD 1 ========== RECORD 2 DATA LINE ========== RECORD 3 ========== RECORD 4 DATA LINE ========== RECORD 5 DATA LINE ========== I need to filter out all data from this file where the... (2 Replies)
Discussion started by: Finja
2 Replies

5. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

6. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

7. Shell Programming and Scripting

Create a multi user input form

Hi All, Please ignore if terminology used is incorrect as I am new to Unix. I want to create a Multi user input form which looks something like this: ABCD TOOL Logged User: abcd12 ... (4 Replies)
Discussion started by: vidhu0007
4 Replies

8. Shell Programming and Scripting

How to use Perl to merge multi-line into single line

Hi, Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line. ******Org. Multi-line) BAM admin 101.203.57.22 ... (3 Replies)
Discussion started by: happyday
3 Replies

9. Programming

How to get capture input events from keyboard and mouse

Hi, Is there any way to capture/record the input events from keyboard, as well as from mouse using C. Thanks in advance (4 Replies)
Discussion started by: yhacks
4 Replies

10. Shell Programming and Scripting

How to capture input files from GETOPT ?

Hi... Could somebody help me how could i captured all input files from the command line ? As example: #./myscript -i input -o output file1.txt file2.txt... Then, based on the example how could i captured "file1.txt" and file2.txt ? could somebody help me ? Attached is some of my... (1 Reply)
Discussion started by: bh_hensem
1 Replies
Login or Register to Ask a Question