Converting pcapng file into csv file - coap

I'm using Ubuntu terminal and I'm running using
tshark -r file.pcapng -T fields -e 6lowpan.src -e frame.proto >file.csv
I also can't get protocol info. I want to convert a .pcapng file into a .csv file.
But, I'm not able to retrieve 6 lowpan source address using 6lowpan.src. In the csv file i am getting empty file without any output and also I want the output data in text format.

Related

Adapt command to creating csv file from storage content including date(time) & file size also

According to thread:
Linux: fast creating of formatted output file (csv) from find command
there is a suggested bash command, including awk (which I don't understand):
find /mnt/sda2/ | awk 'BEGIN{FS=OFS="/"}!/.cache/ {$2=$3=""; new=sprintf("%s",$0);gsub(/^\/\/\//,"",new); printf "05;%s;/%s\n",$NF,new }' > $p1"Seagate-4TB-S2-BTRFS-1TB-Dateien-Verzeichnisse.csv"
With this command, I am able to create a csv file containing "05;file name;full path and file name" of the directory and file content of my device mounted on /mnt/sda2. Thanks again to -> tink
How must I adapt the above command to receive date(&time) and file size also?
Thank you in advance,
-Linuxfluesterer

Is it possible to partially unzip a .vcf file?

I have a ~300 GB zipped vcf file (.vcf.gz) which contains the genomes of about 700 dogs. I am only interested in a few of these dogs and I do not have enough space to unzip the whole file at this time, although I am in the process of getting a computer to do this. Is it possible to unzip only parts of the file to begin testing my scripts?
I am trying to a specific SNP at a position on a subset of the samples. I have tried using bcftools to no avail: (If anyone can identify what went wrong with that I would also really appreciate it. I created an empty file for the output (722g.990.SNP.INDEL.chrAll.vcf.bgz) but it returns the following error)
bcftools view -f PASS --threads 8 -r chr9:55252802-55252810 -o 722g.990.SNP.INDEL.chrAll.vcf.gz -O z 722g.990.SNP.INDEL.chrAll.vcf.bgz
The output type "722g.990.SNP.INDEL.chrAll.vcf.bgz" not recognised
I am planning on trying awk, but need to unzip the file first. Is it possible to partially unzip it so I can try this?
Double check your command line for bcftools view.
The error message 'The output type "something" is not recognized' is printed by bcftools when you specify an invalid value for the -O (upper-case O) command line option like this -O something. Based on the error message you are getting it seems that you might have put the file name there.
Check that you don't have your input and output file names the wrong way around in your command. Note that the -o (lower-case o) command line option specifies the output file name, and the file name at the end of the command line is the input file name.
Also, you write that you created an empty file for the output. You don't need to do that, bcftools will create the output file.
I don't have that much experience with bcftools but generically If you want to to use awk to manipulate a gzipped file you can pipe to it so as to only unzip the file as needed, you can also pipe the result directly through gzip so it too is compressed e.g.
gzip -cd largeFile.vcf.gz | awk '{ <some awk> }' | gzip -c > newfile.txt.gz
Also zcat is an alias for gzip -cd, -c is input/output to standard out, -d is decompress.
As a side note if you are trying to perform operations on just a part of a large file you may also find the excellent tool less useful it can be used to view your large file loading only the needed parts, the -S option is particularly useful for wide formats with many columns as it stops line wrapping, as is -N for showing line numbers.
less -S largefile.vcf.gz
quit the view with q and g takes you to the top of the file.

How do i grep data out of a .txt document in linux?

I am trying to run a grep command on files on my server to find data from e.g. error logs and databases.
grep -r text file
I am running this command and it is not working responds with the error saying
Binary file "FILE"
The file you are searching is not a normal text file, it's a binary file.
If u have a binary file, then most of it will be gibberish when u print it out but some might have ascii text.
To search for a string in a binary file you first need to print the content of the binary file and then pip the output to grep for searching.
cat binaryfile | grep searchstring
You can directly give like this too :-
grep searchstring binaryfile
If the given string is found it will reply with a string matched in binary file message. However unlike a normal text file and binary file doesn't have Line numbers as such for the ASCII text that you find in it. So grep will only say if it matched or not and doesn't give line number which makes sense.

How to use sox with an audio file list

I'd like to merge several audio files. (I'm familiar with using command line tools, but have only rudimentary shell skills.)
Unlike other batch processing command line tools, sox doesn't seem to have a parameter that allows to specify a input file list.
According to the sox documentation, files can be merged using the following command:
sox -m input1 input2 ... inputN output
They also mention that file names can be piped from other apps but don't give any specific examples.
So how do I specify a text file that contains a list of the files to be merged as the input?
BTW, the format of the text file is:
fileRandomID1.wav
fileRandomID2.wav
fileRandomID3.wav
and all files need to be merged in the order in which they're listed in the text file.
If you have a list of the files that you want merged in MergeList.txt and it looks like this:
fileRandomID1.wav
fileRandomID2.wav
fileRandomID3.wav
You can do:
sox -m $(cat MergeList.txt) output.wav

How to convert BCP exported .xls file to actual Excel format file?

I have a batch file with the statement below. The export works fine and results are in the file Corp.xls. However, when I try to open this file, I get a warning 'The file you are trying to open is in a different format that that specified by the file extenion ..........
When I open the file and try to 'Save As', I find that it is in Text-tab delimted format.
Is there any way to convert such a file to excel without having to open the file - i.e from the batch file ?
Note: The batch file is very comples. Given below is just a modified snippet.
BCP "exec DBname.dbo.sp_abc '201503' " queryout "\\ABC\3_MAR\Corp.xls" -T -c -S SCC-SLDB

Resources