hi
i am reading a directory, and reading those files one by one
i need to write some of file contents to a new file ,for this i need to create a new file for each file
please tell me how to create new file in shell script
thanks
Satya
hi
i am reading a directory, and reading those files one by one
i need to write some of file contents to a new file ,for this i need to create a new file for each file
please tell me how to create new file in shell script
thanks
Satya
To write something to a file is fairly simple:
echo "something" > myfile
will put the word something in a file called myfile.
If you are reading a file from a program, you might have the current line of text in a variable called read_line; thus
echo "$read_line" > myfile
Beware that after the first write to the myfile, you should use >> to append to the existing file. You can do that from the start, but need to be sure that first you have an empty myfile.
use the following to create file
touch filename
what content of one file you want to write to other??
is there any specification like line no or if patter found like that??
Try an of the below:
>filename
touch filename
cp /dev/null filename