Sponsored Content
Top Forums Shell Programming and Scripting Loop is not reading tabs from the file Post 302606849 by ezee on Tuesday 13th of March 2012 02:38:54 AM
Old 03-13-2012
I can post the code fragment:
Code:
      DIR_OK=${TARGET_PATH_OK##*/}
      if grep -Fq "${DIR_OK}" "${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}" && [ -d "${TARGET_PATH_OK}" ]
      then
       FXML_index=`grep ${TARGET_PATH#*_} ${PREPAVAL_TRAVAIL}/${HX_header}`
       counter_src=1
       counter_dest=1
       DIR=${FXML_index%.EDI}
       while read FXML_line
       do
        if [ `echo $FXML_line | awk -F ";" '{print $61;}'` = "S" ] -o [ `echo $FXML_line | awk -F ";" '{print $61;}'` = "H" ]
        then
         if [ -d ${PREPAVAL_TRAVAIL}/${DIR} ]
         then    
          echo ${FXML_line} >> ${PREPAVAL_TRAVAIL}/${DIR}/${FXML_index}
          cp ${TARGET_ROOT_PATH}/${DIR_OK}/f`printf "%0.7d" $counter_src`.xml ${PREPAVAL_TRAVAIL}/${DIR}/f`printf "%0.7d" $counter_dest`.xml 2>/dev/null
 
          counter_dest=$(( $counter_dest+1 ))
 
         else
          mkdir ${PREPAVAL_TRAVAIL}/${DIR} 2>/dev/null
 
          echo ${FXML_line} > ${PREPAVAL_TRAVAIL}/${DIR}/${FXML_index}
          cp ${TARGET_ROOT_PATH}/${DIR_OK}/f`printf "%0.7d" $counter_src`.xml ${PREPAVAL_TRAVAIL}/${DIR}/f`printf "%0.7d" $counter_dest`.xml 2>/dev/null
                    counter_dest=$(( $counter_dest+1 ))
 
         fi
        fi
        counter_src=$(( $counter_src+1 ))
       done < "${PREPAVAL_TRAVAIL}/${FXML_index}"
       mv ${PREPAVAL_TRAVAIL}/${DIR} ${TARGET_EDI} 2>/dev/null
              mv ${PREPAVAL_TRAVAIL}/${FXML_index} ${TARGET_EDI} 2>/dev/null

and the exact requirement is the tabs should be read by the loop, it shouldn't be skipped.

Thanks for replying...

Last edited by ezee; 03-13-2012 at 04:03 AM..
 

10 More Discussions You Might Find Interesting

1. HP-UX

How to make a loop base on reading a file?

Need help on making a loop script base on what is inside a file... File to read: List.txt List.txt contains below w/c are file name as well: SAMPLEa SAMPLEb SAMPLEc SAMPLEd SAMPLEe SAMPLEf . . . Want to make a loop that will manipulate those that are inside the file.txt w/c are... (3 Replies)
Discussion started by: JohnBalayo
3 Replies

2. UNIX for Dummies Questions & Answers

How to make a loop base on reading a file?

To make it clearer: I have a file, List.txt List.txt contains: (these are actually splitted files w/c I got from ls command and dump them to the List.txt file) SAMPLEa SAMPLEb SAMPLEc SAMPLEd SAMPLEe SAMPLEf . . . . . And I want to rename these files to have a .dat extension.... (3 Replies)
Discussion started by: JohnBalayo
3 Replies

3. Shell Programming and Scripting

Not access variable outside loop when a reading a file

I am writing a shell script using the korn shell. It seems that I am only able to use local variables within a while loop that is reading a file. (I can't access a variable outside a previously used while loop.) It's been a while since I wrote shell scripts. Here is a sample cat file.txt... (4 Replies)
Discussion started by: ricardo.ludwig
4 Replies

4. Shell Programming and Scripting

How to get the modified value of variable outside the while loop reading from a file

Hi Friends , Sorry if this is a repeated question , The input file contains 5 lines , so the the values of the variables i and count should b i=5; count=15 but the variables are not updating , the value of variables showing i=0 and count =0 only.:mad: can any1 help me please. (11 Replies)
Discussion started by: babusek
11 Replies

5. AIX

How to pause a while loop while reading from a file

Hi, I am building a script to grep for a string in all the files from a folder and display the results. I am reading the files one by one by placing the names in other file using while loop my code is as below while read inp do chk=`grep -c "$str" $pth/$inp` ... (2 Replies)
Discussion started by: sekhar gajjala
2 Replies

6. Shell Programming and Scripting

While loop is not reading next line in the file when IF condition is used.

Hi Guys I am new to scripting.Please forgive for asking basic questions. I want to write a script to check whether the logs are getting updated in last 15 mins. cat server 192.168.1.6 192.168.1.7 cat list 192.168.1.7 /logs/logpath1 192.168.1.7 /logs/logpath2 192.168.1.6... (4 Replies)
Discussion started by: vdurai
4 Replies

7. Shell Programming and Scripting

reading the values from a file in C Shell for loop

Hi All, I need small help on for loop syntax in C shell. How can we read the values from a file (line by line) through C shell loop. For Ex: $Cat file1 data1 data2 data3 data4 $ I have to print those values in a variable and have to perform some steps... Can anyone help on... (2 Replies)
Discussion started by: raghu.iv85
2 Replies

8. Shell Programming and Scripting

Need help with perl script with a while loop reading file

Good morning, I appreciate any assistance that I can get from the monks out there. I am able to get this to work for me so that I can do a hostname lookup if I only specify one hostname in the script. What I want to do is have a file with hostnames and do lookups for each name in the file. Here is... (1 Reply)
Discussion started by: brianjb
1 Replies

9. Shell Programming and Scripting

Removing \r and \n during reading file through while loop

Hi, I am writing in a file through cat command. This file will contain the path of file along with filename. e.g. /home/user/folder1/folder2/filename.txt There might be very large number of this path in same file like say 140 when I try to run while command: while read -r file do //command... (8 Replies)
Discussion started by: Pulkit Lall
8 Replies

10. Shell Programming and Scripting

Sequential Reading from two file in a loop

Hello All, I have two files with me file1.txt and file2.txt file1.txt has: 333 222 111 file2.txt has ccc bbb aaa ccc is related to 333 only, bbb is related to 222 only and aaa is related to 111 only. I have to get the values from each of the file and pass them in the URL... (3 Replies)
Discussion started by: ankur328
3 Replies
APPLE_DUMP(1)							   Netatalk 2.2 						     APPLE_DUMP(1)

NAME
apple_dump - Dump AppleSingle/AppleDouble format file SYNOPSIS
apple_dump [-a] FILE | DIR apple_dump -f FILE apple_dump -d FILE apple_dump -h | -help | --help apple_dump -v | -version | --version DESCRIPTION
apple_dump dump AppleSingle/AppleDouble format file. OPTIONS
-a FILE|DIR This is default. Dump a AppleSingle/AppleDouble file for FILE or DIR automatically. Extrapolate FinderInfo type from absolute path. If FILE is not AppleSingle/AppleDouble format, look for .AppleDouble/FILE and ._FILE. If DIR, look for DIR/.AppleDouble/.Parent and ._DIR. -f FILE Dump FILE. Assume FinderInfo to be FileInfo. -d FILE Dump FILE. Assume FinderInfo to be DirInfo. -h, -help, --help Display the help and exit -v, -version, --version Show version and exit NOTE
There is no way to detect whether FinderInfo is FileInfo or DirInfo. By default, apple_dump examins whether file or directory, a parent directory is .AppleDouble, filename is ._*, filename is .Parent, and so on. If setting option -f or -d, assume FinderInfo and doesn't look for another file. SEE ALSO
ad(1) Netatalk 2.2 02 Sep 2011 APPLE_DUMP(1)
All times are GMT -4. The time now is 06:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy