Problem in reading the input value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in reading the input value
# 1  
Old 09-04-2012
Problem in reading the input value

Code:
echo "Enter the Value : "
read value
sed '1s:\(.\{6\}\)\(.\{4\}\):\1'$value':' flextran$RUN_DATE-completed.txt > temp.txt
mv temp.txt flextran$RUN_DATE-completed.txt

on the run time after entering the input value it waits for keystroke and the values is not input to the function

The output shows as,
Code:
Enter the Value :
2492  [Enterned value]


---- it exitst after 3 times pressing enter
it also does not take the input value for the sed command. please give some help to solve this condition.

Last edited by Franklin52; 09-04-2012 at 06:45 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 09-04-2012
Please execute the script with xtrace enabled and post the output.

Code:
sh -xv <your_script>

Change sh with the shell you're currently using.
# 3  
Old 09-04-2012
Code:
+ echo Enter the Value :
Enter the Value :
+ read value
3135


+ sed 1s:\(.\{6\}\)\(.\{4\}\):\1: flextran20120900-completed.txt
+ 1> temp.txt
+ mv temp.txt flextran20120900-completed.txt

This is the output i got after setting xtrace
# 4  
Old 09-04-2012
I cannot reproduce this behavior with your script. Could you try to run the script from a different terminal? Which shell are you using?
# 5  
Old 09-04-2012
we are using bash and Kshell. Some times i m getting the correct output, but sometimes it waits for press 3 times enter and also didt get ouput
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading user input...problem with tab key

Hi all, I have a little problem with my shell script (reading user input, save user input to variable, invisible characters in the log file :() printf "1. What's your file path?" /path/to/my/file read -e FILE I have invisible characters in my log file (e.g. <ESC> or ^G) when I'm... (3 Replies)
Discussion started by: splendid
3 Replies

2. Shell Programming and Scripting

Reading from standard input

So, I am new to shell scripting and have a few problems. I know how to read from standard input but I do not know how to really compare it to say, a character. I am trying to compare it to a character and anything exceeding just a character, the user will get an output message, but the program... (7 Replies)
Discussion started by: Bungkai
7 Replies

3. Shell Programming and Scripting

[SH] Problem reading input in script

Alright, so the goal of my script is to read text from standard input and store it into a file using the ex-editor: so far i've got this, but it doesn't work. #!/bin/s read text ex $1 >> HERE text HERE I don't get any errors either, so i don't know what i'm doing wrong. (7 Replies)
Discussion started by: Bertieboy7
7 Replies

4. Shell Programming and Scripting

Reading Standard Input

Hello, I am new to scripting. How do I read multiple lines from the command line? I know read reads one line, but if I have to read multiple lines, how should I do? Thanks, Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies

5. Shell Programming and Scripting

Reading from input with sed

I am trying to edit a file in shell script using sed. I need to get the input from command line suppose script.sh sed"/s place=/place=california/g" > /root/user/mark.txt echo " place changed " the above code searches for string place in the file mark.txt and replaces with place=... (5 Replies)
Discussion started by: sriki32
5 Replies

6. UNIX for Dummies Questions & Answers

Intermittent problem reading from an input file.

First of all thanks to all for the good post, and the great site. I'm a noob, but I've been able to learna a lot by checking past posts. I haven't been able to make sense of a problem that I've been working on for a while, hopefully someone can help me out. The script I wrote telnets into... (7 Replies)
Discussion started by: Wallygooo32
7 Replies

7. Shell Programming and Scripting

Reading input files

Okay, so I've looked on here and found some similar things, but not exactly what I am looking for. I am working on creating a script that can back up some files, based on the contents of another file - the configuration file. First file contains the files to back up - we'll call this... (1 Reply)
Discussion started by: pdxwarrior
1 Replies

8. Shell Programming and Scripting

Reading specific contents from 1 input files and appending it to another input file

Hi guys, I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help. I have 2 input files (example given below) Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies

9. Shell Programming and Scripting

reading from input

Hi guys , As you know normally ' read ' statement waits for the user to press enter and then terminates the input ............. Can anyone of u tell me how do i read a single character from input without waiting for the user to press enter ................ Thanks, Nagesh. (1 Reply)
Discussion started by: nageshrc
1 Replies

10. UNIX for Dummies Questions & Answers

Reading Input in a Script

#!/usr/bin/sh echo "Enter reason:" echo "> \c" read $reason $reason >> access.log This doesnt work for me. Can someone tell me how I would read the input from what the person types, and then append that to the log file? Regards (2 Replies)
Discussion started by: alwayslearningunix
2 Replies
Login or Register to Ask a Question