Sponsored Content
Top Forums Shell Programming and Scripting Need to prepare a CSV table with inputs from multiple files Post 303040665 by RudiC on Sunday 3rd of November 2019 03:58:45 PM
Old 11-03-2019
Try
Code:
awk -F/ '
NR == 1         {printf "Sl#,VideoName,BitRate"
                }
FNR == NR       {PRM[NR] =  "( |no-)" $0 "=*[^ /]*"
                 MX = NR
                 printf ",%s", $0
                 next
                }
!HDFIN          {printf RS
                 HDFIN = 1
                }
FNR == 1        {gsub (" ", "", $3)
                 printf "%d,%s,%d", ++FCNT, FILENAME, $3+0
                }
FNR == 3        {for (i=1; i<=MX; i++)  {match ($0, PRM[i])
                                         if (2 == split (substr ($0, RSTART, RLENGTH), TMP, "=")) printf ",%s", TMP[2]
                                           else printf ",%d", (! (TMP[1] ~ /^no/))
                                        }
                 printf RS
                }

' Required_para.txt OFS=, vid?
Sl#,VideoName,BitRate,input-res,crf,aq-mode,strong-intra-smoothing,bframes,rc-lookahead,me,subme,merange,deblock,selective-sao,psy-rd,psy-rdoq,ctu,rdoq-level,max-merge,ref,max-tu-size,transfer,colormatrix,colorprim
1,vid1,5750,1920x816,23.3,3,0,8,100,3,7,92,0:0,1,2.00,1.00,32,2,4,5,16,1,1,1
2,vid2,3711,1920x804,18.0,3,1,8,25,3,3,57,0:0,0,2.00,1.00,64,2,3,4,32,2,2,2
3,vid3,7903,1920x800,18.0,3,1,8,25,3,3,57,0:0,0,2.00,1.00,64,2,3,4,32,2,2,2


Last edited by RudiC; 11-03-2019 at 05:20 PM..
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Pull out multiple files from DB table and redirect all those files to a differetn directory?

Hi everyone!! I have a database table, which has file_name as one of its fields. Example: File_ID File_Name Directory Size 0001 UNO_1232 /apps/opt 234 0002 UNO_1234 /apps/opt 788 0003 UNO_1235 /apps/opt 897 0004 UNO_1236 /apps/opt 568 I have to... (3 Replies)
Discussion started by: ss3944
3 Replies

2. Shell Programming and Scripting

Copying multiple csv files

Hi, I have mutiple csv files at server1 at /apps/test/data. I needed a script that would copy these csv files from server1 at /usr/data, put them in server2,archive the earlier files that were present in server2 before removing those already present. Kindly help. (2 Replies)
Discussion started by: Alok Ranjan
2 Replies

3. Shell Programming and Scripting

Field validations in multiple files CSV

Hi, I am regular reader of this forum. My advanced thanks to everyone. Below given are the sample files INDATA (Main data) Fild1Çfld2Çfld3….. Fild1Çfld2Çfld3….. Fild1Çfld2Çfld3….. Fild1Çfld2Çfld3….. Fild1Çfld2Çfld3….. . . N records (140000) eg GRPDATA (Reference file) (2 Replies)
Discussion started by: hyperion.krish
2 Replies

4. Shell Programming and Scripting

reading information from a table and apply a command on multiple files

Hey gyuz, I wanna calculate the number of mapped reads of a bam file in a region of interest. I used this code to do so : samtools view input.bam chrname:region1 > region1.txt This will store all the reads from given bam file within the region of interest in region1.txt Now I have... (5 Replies)
Discussion started by: @man
5 Replies

5. Shell Programming and Scripting

Find values in multiple csv files

Hi, I'd like to find the values of certain fields in multiple csv files stored in 1 directory based upon an input search string. An fgrep returns the complete record, I only want certain fields. Thanks in advance for your help. Perry (6 Replies)
Discussion started by: biscayne
6 Replies

6. Shell Programming and Scripting

Split a .csv File into Multiple Files

Hi guys, I have a requirement where i need to split a .csv file into multiple files. Say for example i have data.csv file and i have splitted that into multiple files based on some conditions i.e first file should have 100, last file 50 and other files 1000 each. Am passing the values in... (2 Replies)
Discussion started by: azherkn3
2 Replies

7. Shell Programming and Scripting

Insterting column in csv from multiple files

Hello, I have a spec file that contains a lot of strings that looks like this: PC DELL OptiPlex 3010MT i3 3220/2GB/500GB/DVD-RW/FREE DOS / 5Y NBD Intel i3 3220 (Dual Core, 3.30GHz, 3MB, w/ HD2500 Graphics), 2GB (1x2GB) DDR3 PC3-1600MHz, 500GB HDD SATA III 7200rpm, DVD+/-RW (16x),... (9 Replies)
Discussion started by: g9100
9 Replies

8. UNIX for Dummies Questions & Answers

Load multiple files into a table

Hi, I need to load data from two files to a single table. My requirement is that I get two files in which a few column data are manadatory. These files are identified based on the file name. For example, I have two files ABCFile and BCDFile. ABCFile has mandatory data in column 3 and 4... (0 Replies)
Discussion started by: reshma15193
0 Replies

9. Shell Programming and Scripting

CSV joining and checking multiple files

Hello, For our work we use several scripts to gather/combine data for use in our webshop. Untill now we did not had any problems but since a couple days we noticed some mismatches between imports. It happened that several barcodes where matched even though it was a complete other product. Of... (19 Replies)
Discussion started by: SDohmen
19 Replies

10. UNIX for Beginners Questions & Answers

Export Oracle multiple tables to multiple csv files using UNIX shell scripting

Hello All, just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table. Can you please suggest why? or any better idea? export FILE="/abc/autom/file/geo_JOB.csv" Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies
MEDIAINFO-GUI(1)						   User Commands						  MEDIAINFO-GUI(1)

NAME
MediaInfo - command line utility to display information about audio/video files MediaInfo-Gui - graphical utility to display information about audio/video files SYNOPSIS
mediainfo [-Options...] FileName1 [Filename2...] mediainfo --Inform=FMT FileName mediainfo-gui [-Options...] FileName1 [Filename2...] mediainfo-gui --Inform=FMT FileName DESCRIPTION
MediaInfo supplies technical and tag information about a video or audio file What information can I get from MediaInfo? - General: title, author, director, album, track number, date, duration... - Video: codec, aspect, fps, bitrate... - Audio: codec, sample rate, channels, language, bitrate... - Text: language of subtitle - Chapters: number of chapters, list of chapters What format does MediaInfo support? - Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB)... - Video Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC... - Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF... - Subtitles: SRT, SSA, ASS, SAMI... What can I do with it? - Read many video and audio file formats - View information in different formats (text, sheet, tree, HTML...) - Customise these viewing formats - Export information as text, CSV, HTML... - Graphical Interface, Command Line, or library versions available OPTIONS
MediaInfo supports the following case-insensitive options: --Help, -h Display help and exit --Help-Inform Display help for --Inform option --Help-AnOption Display help for "AnOption" --Version Display MediaInfo version and exit --Full, -f Full information Display (all internal tags) --Output=HTML Full information Display with HTML tags --Output=XML Full information Display with XML tags --Inform=FMT Template defined information display. FMT is "[xxx;]Text", where xxx can be any one of General, Video, Audio, Text, Chapter, Image, or Menu. Text can be the template text, or a filename in the form of file:///path See --Info-Parameters for available parameters in the text. Parameters must be surrounded by "%". --Info-Parameters Display list of --Inform parameters --Language=raw Dislpay non-translated unique identifiers (internal text) --LogFile=LogFile Save the output in LogFile EXAMPLES
Display information about a video file $ mediainfo foo.mkv Display aspect ratio $ mediainfo --Inform="Video;%DisplayAspectRatio%" foo.mkv $ mediainfo --Inform="Video;file://Video.txt" foo.mkv Both forms are equivalent if Video.txt contains: %DisplayAspectRatio% Display aspect ration and audio format $ mediainfo --Inform="file://Text.txt foo.mkv If Text.txt contains: - "Video;%DisplayAspectRatio%" Then the display aspect ratio is printed out. - "Audio;%Format%" Then the audio format is printed out. AUTHOR
This manual page was written by Chow Loong Jin <hyperair@debian.org> for the Debian system (but may be used by others). Permissions is granted to copy, distribute, and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the full text of the GNU General Public License, Version 3 can be found in /usr/share/common-licenses/GPL-3. MediaInfo 0.7.52 2012-06-03 MEDIAINFO-GUI(1)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy