Attention: ls omits the path,
so in the loop you must prepend it to the loop variable like "$path/$file"
Or you do
--
Yes, the inner loop looks odd - certainly not yet ready...
The odd indentation didn't help in trying to figure out what the inner loop was doing and the fact that the inner loop variable is never referenced is some kind of clue (I think).
I should have just said to cd to the directory before the outer loop and use ls (or printf '%s\n' *) piped through tail which would also allow replacing:
with just:
in the final echo in the outer loop.
This User Gave Thanks to Don Cragun For This Post:
Hi, hopefully this is a fairly simple Q&A.
I have a clean file list of approximately 180 filenames with no directory or slashes in front of the filename nor any extension or dot ".". I would like to read from this list, find these files recursively down through directory trees, copy the files... (1 Reply)
Hi,
I have a requirement where I have get the files from FTP server then delete the files in the FTP server and then store the file name within the file where there is "TR".
i.e
Filename|TR|20071231|....
Once I finish loading my file I have to archive the files.
Is there any way to do it... (2 Replies)
hi
i have a directory /tmp/Satya,it contains
5.FILE
6.FILE
7.FILE
i need to read each file , and read its content line by line
please help
thanks
Satya (2 Replies)
Hello friends,
I am newbie in programing. I am facing some problems in awk. Please help me.
I have a file with many data sets. Each data set is separated by an empty line. For example
Col1 Col2 Col3 Col4 Col5
0.85 0.07 Fre 42:86 25
0.73 0.03 frp 21:10 28
0.64 0.04 Fre 42:86 63
0.47 0.08... (2 Replies)
Hello, I'm trying to create a BASH file that can read all the files in my working directory and tell me how many words and lines are in that file. I wrote the following code:
FILES="*"
for f in "$FILES"
do
echo -e `wc -l -w $f`
done
My issue is that my file is outputting in one... (4 Replies)
Hi ,i have a question ,if I am in sertain directory and I have 4 files *.c
how can I read and append this files in file backup.bac
Thanks
find ./ -name "*.csh" | wc -l (2 Replies)
Hello,
Below, I have a unix command, which can be executable for single file.
cat input.txt | sort -k3,3 > output.txt
I have 100 input files in a directory. It is hectic and time taking to run the above command for all the 100 files for 100 times.
Now, I want to execute the above unix... (2 Replies)
Hi All
Can anybody let me know the code to read a particular record from a file
For e.g.
File Name: File.txt
File content:
Script_path=/abc/def/script/
File_path=/xyz/data/
Business Date=19990905
SERVER_NAME=Server
DATABASE_NAME=Database
Login=NewUser
Password=NewPassword
... (3 Replies)
awk 'NR==FNR{arr;next} $0 in arr' /tmp/Data_mismatch.sh /prd/HK/ACCTCARD_20160115.txt
edit by bakunin: seems that one CODE-tag got lost somewhere. i corrected that, but please check your posts more carefully. Thank you. (5 Replies)
Discussion started by: suresh_target
5 Replies
LEARN ABOUT V7
break
break(1) User Commands break(1)NAME
break, continue - shell built-in functions to escape from or advance within a controlling while, for, foreach, or until loop
SYNOPSIS
sh
break [n]
continue [n]
csh
break
continue
ksh
*break [n]
*continue [n]
DESCRIPTION
sh
The break utility exits from the enclosing for or while loop, if any. If n is specified, break n levels.
The continue utility resumes the next iteration of the enclosing for or while loop. If n is specified, resume at the n-th enclosing loop.
csh
The break utility resumes execution after the end of the nearest enclosing foreach or while loop. The remaining commands on the current
line are executed. This allows multilevel breaks to be written as a list of break commands, all on one line.
The continue utility continues execution of the next iteration of the nearest enclosing while or foreach loop.
ksh
The break utility exits from the enclosed for, while, until, or select loop, if any. If n is specified, then break n levels. If n is
greater than the number of enclosing loops, the outermost enclosing loop shall be exited.
The continue utility resumes the next iteration of the enclosed for, while, until, or select loop. If n is specified then resume at the n-
th enclosed loop. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be used.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words that follow a command preceded by ** that are in the format of a variable assignment are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign, and also that word splitting and file name genera-
tion are not performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), exit(1), ksh(1), sh( 1), attributes(5)SunOS 5.10 17 Jul 2002 break(1)