Content of filtered files write as columns into one file
Hi everybody!
i have a lot of files where i filter out data.
what i have: several files where i filter out the first column:
what i want to have is --> write the filtered columns into one file - as a table
as you can see in the top example, i try to do it with paste, but that will not work propper. moreover i want a part of the filename in the top of every column
I dont have experience with awk-arrays - can someone help me to solve this in a reliable working script?
There are enough strange constructs in your sample shell script that I am not at all sure what you are trying to do, what your input files look like, nor what your output file is supposed to look like. It seems to be a very expensive way of copying the last regular file it processes to the file named test_f.txt.
Please show us three short sample input files (including their full filenames; not just the pattern that matches them), and show us the exact output you want to produce from those three sample input files. And, it is always helpful to know what operating system (including its release/version information) you're using and the version of the shell you're using.
This User Gave Thanks to Don Cragun For This Post:
There are enough strange constructs in your sample shell script that I am not at all sure what you are trying to do, what your input files look like, nor what your output file is supposed to look like. It seems to be a very expensive way of copying the last regular file it processes to the file named test_f.txt.
Please show us three short sample input files (including their full filenames; not just the pattern that matches them), and show us the exact output you want to produce from those three sample input files. And, it is always helpful to know what operating system (including its release/version information) you're using and the version of the shell you're using.
Hi Don!
Sorry for being not accurate!
OS: Linux ass210 3.16.7-13-desktop #1 SMP PREEMPT Wed Mar 18 17:31:15 UTC 2015 (ba2afab) x86_64 x86_64 x86_64 GNU/Linux
Shell: GNU bash, version 4.2.53(1)-release (x86_64-suse-linux-gnu)
input file [sample_001.Spe]. Up to 40 files with the subsequent structure and ascending number after the underscore [ sample_001.Spe, sample_002.Spe ... sample_040.Spe] .
structure of the input file: i haven't put all the 255 lines; i stretched the main part, but all of them are numbers. moreover i marked the for me important parts blue.
The for me interesting data i want to get out of each file by using
and put the extracted columns (i.e. 40 columns from 40 files) into one file.
furthermore the output file should have a csv-format to transfer it to M$-Excel. It should look like the following example; the 3 dots in every column and the 3 dots in every line should represent the vertical and horizontal ellipsis :
can you please help me.
You might want to try this instead:
It invokes awk once instead of 80 times, creates each of your testsample_*.Spe.txt files once instead of twice, invokes paste once instead of 80 times, and doesn't redirect the output of paste to one of its input files (which wiped out most of the work you were trying to do).
This assumes that your data doesn't have any fields wider than 13 characters and that you want data left aligned in each column (which matches the 1st two columns of output in your second sample output file.
This User Gave Thanks to Don Cragun For This Post:
thanks a lot for solving my problem.
Unfortunatelly i don't understand your
script completely but i can work with it.
It gives me what i want propper and efficiently!
I need to figure out how many times a location (columns 1 and 2) is present within a group of files. I figured using a combination of 'while read' and 'grep' I could count the number of instances but its not working for me.
cat file.txt | while read line
do
grep $line *08-new.txt | wc -l... (6 Replies)
Hello all,
I have a string and would like to extract the content of the text within the brackets.
Here is the string:
Desc="file from to line"
What I would like to have is the following:
Filename="4009821_737498.out"
FromLine=12965
ToLine=12355
Maybe I have to do this with... (6 Replies)
I have 8 .csv files with 16 columns and "n" rows with no Header. I want to parse each of these .csv and get column and put the data into a new.csv. Once this is done, the new.csv should have 16 columns (2 from each input.csv) and "n" rows.
Now, I want to just take the average of Column from... (3 Replies)
Hi I have multiple files in a folder and one file which contains a list of files (one on each line). I was to search for a string only within these files and not the whole folder. I need the output to be in the form
File1<tab>string instance 2<tab> string instance 2<tab>string instance 3... (6 Replies)
Hi , Need to shell script to extracts files names and write those to another file in different directory.
input file is
inputfile.txt
abc|1|bcd.dat
123 david123
123 rudy2345
124 tinku5634
abc|1|def.dat
123 jevid123
123 qwer2345
124 ghjlk5634
abc|1|pqr.txt
123 vbjnnjh435
123 jggdy876... (1 Reply)
Hello,
I need to do one thing that my script creates the file
touch release.SPLASH_12_03_00_RC01.txt
Now I want to update that file with some content e.g
splashbuild::SPLASH_12_17_00_RC02.zip
Thanks (1 Reply)
Hi,
Help required to split record value and write to new row.
Input
a~b~c~value in ('3','4','5')~test
output
a~b~c~3~test
a~b~c~4~test
a~b~c~5~test
input
a~b~c~value in ('3','4')~test
output
a~b~c~3~test
a~b~c~4~test (8 Replies)
Hi
I have a control file which looks like this
LOAD DATA
INFILE '/home/scott/XXX.dat'
PRESERVE BLANKS
.............
.............
how can i change the content of this file and replace the file in the second line with anothe file name and write it back with another name to the disk?
... (5 Replies)
Hi guys
Im new to forum so please dont be hard to me if I make any mistakes :)
I want to the following task:
1. I have a file lets say file1, which contains job names with numbers which have failed to start and ....
I can sort that file into another to get only the Job numbers with... (3 Replies)
guys i have a question:
i'd like to sort files (as many I want) in columns so to visualize them one near the other...so let's say i have just 2 files:
FILE1
John
Mary
Bridget
FILE2
Anne
Robert
Mark
i would like to obtain:
John Anne
Mary Robert
Bridget ... (2 Replies)