script doesn´t read last line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script doesn´t read last line
# 1  
Old 05-07-2008
script doesn´t read last line

hi, i have a file with 5 lines, like this:

068|3|20080331|P|21090|5|0|0|0|0|0|0|0
068|3|20080331|P| |6|0|0|0|0|0|0|0
068|3|20080331|P|21040|7|0|233|105|161|6157|6656|101
068|3|20080331|P| |T|188842|33996|14543|3226|7193|247800|298
068|3|20080331|T| |T|322468|43073|24411|12916|8654|411522|1779
~
~
~

there is not space after the last value of the last line (1779 in dark red)
the probles is what if i do "wc -l my_file" i have 4 lines, but there are 5 lines,
idem, if i copy the file to another using a script in ksh doesn´t copy the last line, only copy to the new file 4 lines
i believe the problem is because there is not space after the last value of the last line, or because there is not a "\n"

what can i do???
please, help me
thanks
# 2  
Old 05-07-2008
please paste tail -1 your.file |od -cx

and or run set list in vi and paste. I wonder if you have some non-printable characters messing it up.
# 3  
Old 05-08-2008
put set -x in your script run it and put the output here.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name data_file.txt column_name file_name col1 file1 col2 file2 col3 file1 col4 file1 col5 file2 now, i would like to... (4 Replies)
Discussion started by: tester111
4 Replies

2. Shell Programming and Scripting

Read in script doesn't work

I am trying to run a script to make a simple modification to a number of similar files. The sed works, but after it runs and the differences are displayed, the script does not read ans to start a renaming script if the user answered Y or y.for i in "$@" do sed -f myfile.sed $i >$i.new diff... (2 Replies)
Discussion started by: wbport
2 Replies

3. Shell Programming and Scripting

With script bash, read file line per line starting at the end

Hello, I'm works on Ubuntu server My goal : I would like to read file line per line, but i want to started at the end of file. Currently, I use instructions : while read line; do COMMAND done < /var/log/apache2/access.log But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies

4. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies

5. Shell Programming and Scripting

How to read a two files, line by line in UNIX script and how to assign shell variable to awk ..?

Input are file and file1 file contains store.bal product.bal category.bal admin.bal file1 contains flip.store.bal ::FFFF:BADC:CD28,::FFFF:558E:11C5,6,8,2,1,::FFFF:81C8:CA8B,::FFFF:BADC:CD28,1,0,0,0,::FFFF:81C8:11C5,2,1,0,0,::FFFF:81DC:3111,1,0,1,0 store.bal.... (2 Replies)
Discussion started by: veeruasu
2 Replies

6. Shell Programming and Scripting

Shell script to read multiple options from file, line by line

Hi all I have spent half a day trying to create a shell script which reads a configuration file on a line by line basis. The idea of the file is that each will contain server information, such as IP address and various port numbers. The line could also be blank (The file is user created). Here... (1 Reply)
Discussion started by: haggismn
1 Replies

7. Shell Programming and Scripting

Shell script to read a text file line by line & process it...

Hi , I am trying to write an shell, which reads a text file (from a location) having a list of numbers of strictly 5 digits only ex: 33144 Now my script will check : 1) that each entry is only 5 digits & numeric only, no alphabets, & its not empty. 2)then it executes a shell script called... (8 Replies)
Discussion started by: new_to_shell
8 Replies

8. Shell Programming and Scripting

bash: read file line by line (lines have '\0') - not full line has read???

I am using the while-loop to read a file. The file has lines with null-terminated strings (words, actually.) What I have by that reading - just a first word up to '\0'! I need to have whole string up to 'new line' - (LF, 10#10, 16#A) What I am doing wrong? #make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies

9. Shell Programming and Scripting

Output of Shell Script Doesn't Skip to next line

Hi. This is what I coded: tput cup $1 $2 # place cursor on row and col tput clear # clear the screen bold=`tput smso` #set stand-out mode - bold offbold=`tput rmso` # reset screen - turn bold off echo $bold # turn bold on tput cup 10 20; echo "Type Last Name:" #bold caption tput cup 12... (3 Replies)
Discussion started by: Ccccc
3 Replies

10. Shell Programming and Scripting

command line work script doesn't

Hello, I'm stuck and confused as to why when I execute things form the command line it works but when in a script it doesn't. My script: ### creating a lock on the console touch /var/run/console.lock chmod 600 /var/run/console.lock echo "$User" >>... (2 Replies)
Discussion started by: larry
2 Replies
Login or Register to Ask a Question