12-10-2007
Hi,
I tried on the below code but it doesnt work at all. The execution get stuck
Actually, I can get the string name for filename manually by using
filters=${x:37}
And I would like to read in multiple files of .txt.And end up having these string on the front of the numbers which are extracted for each file.
For example:-
I have 2 files which is bla1.txt and bla2.txt which contains all the numbers to parse horizontally with "," in another new file; called output.txt
In the output.txt, it would be expected to have :-
bla1,1,0,0...........
bla2,1,0,1,...........
I have this code:-
echo $PWD
for x in /home/*; do
filters=${x:37}
cat *.txt| sed 's/^[ ]*//' |sed 's/^-/0/'|sed 's/^#####/0/'|sed '/^[^0-9-]/d'|tr ':' "," |awk '
{
printf ("%s",$1);
}
{
printf("\n");}'> output.txt
But I do not know where to include the $filters in front of each file (.txt) parsed. Besides, the "\n" doesnt work for each file parsed.
Please advise. Thanks alot.
-Jason
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Please help me out with a script which checks whether a given file say abc.txt is in ASCII format and data is tab-delimited. If the condition doesn't satisfy then it should generate error code "100" for file not in ASCII format and "105" if it is not in tab-delimited format.
If the... (9 Replies)
Discussion started by: Mandab
9 Replies
2. Shell Programming and Scripting
This data comes form the table and exported into the file in this format
File1 Format
weboffercode1,sourcecode1,1,1,1,1,1,1
weboffercode1,sourcecode2,1,1,1,1,1,1
weboffercode1,sourcecode1,1,1,1,1,1,1
weboffercode1,sourcecode3,1,1,1,1,1,1
weboffercode1,sourcecode3,1,1,1,1,1,1
... (4 Replies)
Discussion started by: enigma_83
4 Replies
3. Shell Programming and Scripting
from CLI pressing Tab and character like a shows result of the commands starting with a,
can i use this in a script too and post the results to a file?
thanks (1 Reply)
Discussion started by: tvrman
1 Replies
4. Shell Programming and Scripting
Dear Unix champs,
I have a input file as attached, i would like to create an report from the file as below
FileType | EQUENS0001 | EQUENS0002 | EQUENS1100 | EQUENS0003
--------+--------------------------------------------------------
Msg No |... (3 Replies)
Discussion started by: manas_ranjan
3 Replies
5. UNIX for Advanced & Expert Users
I want to create the format file for bcp in a file to the table.
My Versions are:
Unix: Sun OS,
DB: Sybase.
How can i create the format file.
Is there any way to create the format by bcp command
or some system sp.
Please help. (3 Replies)
Discussion started by: Arunprasad
3 Replies
6. Shell Programming and Scripting
Title is very broad, but here's an outline of what I have done so far:
- I have multiple subdirectories containing multiple *.fna files of DNA sequences
- I've been able to traverse these subdirectories and create a tab-delimited text file (i.e. the association file) that shows the contents of... (1 Reply)
Discussion started by: shwang3
1 Replies
7. UNIX for Dummies Questions & Answers
I have a text file that made using text editor in Ubuntu. However the text file is not being recognized as space or tab delimited, the formatting seems to be messed up. How can I convert the text file into tab delimited format? (3 Replies)
Discussion started by: evelibertine
3 Replies
8. Shell Programming and Scripting
Hi Guys,
I have a file. Each record needs to inserted into a table. The table also have other columns which needs to be inserted with Shell variables.
The following is the file.
Error code None.
Error Code 1
The shell script is having these variables.
Name=Magesh
Dep=Coding
... (1 Reply)
Discussion started by: mac4rfree
1 Replies
9. Shell Programming and Scripting
needed touch command to create a file in the following format
touch a_yyyymmdd_hhmmss (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies
10. UNIX for Beginners Questions & Answers
hi linux expert
is there any program for create movie file from pictures file (like jpg)?
Many Thanks
samad (1 Reply)
Discussion started by: abdossamad2003
1 Replies