cut

How will cut options -b and -c become different with Internationalization

元气小坏坏 提交于 2019-12-11 11:26:08
问题 `-b BYTE-LIST' `--bytes=BYTE-LIST' Select for printing only the bytes in positions listed in BYTE-LIST. Tabs and backspaces are treated like any other character; they take up 1 byte. If an output delimiter is specified, (see the description of `--output-delimiter'), then output that string between ranges of selected bytes. `-c CHARACTER-LIST' `--characters=CHARACTER-LIST' Select for printing only the characters in positions listed in CHARACTER-LIST. The same as `-b' for now, but

Find HEX value in file and grep the following value

大城市里の小女人 提交于 2019-12-11 08:58:59
问题 I have a 2GB file in raw format. I want to search for all appearance of a specific HEX value "355A3C2F74696D653E" AND collect the following 28 characters. Example: 355A3C2F74696D653E323031312D30342D32365431343A34373A30322D31343A34373A3135 In this case I want the output: "323031312D30342D32365431343A34373A30322D31343A34373A3135" or better: 2011-04-26T14:47:02-14:47:15 I have tried with xxd -u InputFile | grep '355A3C2F74696D653E' | cut -c 1-28 > OutputFile.txt and xxd -u -ps -c 4000000

Source file delimiter issue

匆匆过客 提交于 2019-12-11 08:19:29
问题 I am facing one issue with my source file. Consider I have following data in file- "dfjsdlfkj,fsdkfj,werkj",234234,234234,,"dfsd,etwetr" here, the delimiter is comma, but some fields have comma as a part of data. Such fields are enclosed in double quotes. I want to extract few columns from the file. If I use cut -d "," -f 1,3 then I am getting output like- "dfjsdlfkj,werkj" 回答1: I suggest you to use a csv parser. For example, python has one as a built-in module, so you only have to import it:

union of two columns of a tsv file

心不动则不痛 提交于 2019-12-11 07:45:46
问题 I've a file which stores a directed graph. Each line is represented as node1 TAB node2 TAB weight I want to find the set of nodes. Is there a better way of getting union? My current solution involves creating temporary files: cut -f1 input_graph | sort | uniq > nodes1 cut -f2 input_graph | sort | uniq > nodes2 cat nodes1 nodes2 | sort | uniq > nodes 回答1: { cut -f1 input_graph; cut -f2 input_graph; } | sort | uniq No need to sort twice. The { cmd1; cmd2; } syntax is equivalent to (cmd1; cmd2)

How to use unix scripts to show all 'n' characters long group of strings?

牧云@^-^@ 提交于 2019-12-11 07:24:57
问题 This IS kind of linked to another question - Code golf: "Color highlighting" of repeated text I'm tying to figure out a way of breaking a file into all 'n' characters long groups. Eg: If a file comprises of ONLY the following text: ABCDEFGHIJ And we want it broken into sets of 3, the output should be: ABC BCD CDE DEF EFG FGH GHI HIJ No characters in the file are to be treated any differently from another. ie, a "space" is just another character which should follow the rule above... 回答1: sed:

Grep / awk greater than date

蓝咒 提交于 2019-12-11 05:49:18
问题 I'm sure this is an easy one for the Gurus. I'm working on my get things done and todo system. At the moment I've simply got a markdown file which I edit in VI and set tags against my things to do. It looks like this # My project | @home - Do this this | @home I think sync this file across my devices and use tasker / grep on android to show me the todo based on where I am. I've now got to the stage where I want to add things to do in the future so I was thinking of something like - Do this

ffmpeg cut and concat single command line

时光总嘲笑我的痴心妄想 提交于 2019-12-11 00:54:37
问题 I have two flac audio files, I need to cut them with different timecodes and then concatenated them using one single command line with ffmpeg. Is there a way to do it? I did something like that but it's not working very well, the timestamps of the outputs file are all messed up (instead of having an output flac beginning from 00:00 I have a file beginning from 59:90!!) Also this command line is insanely slow and it works only on unix system...hope someone could help me mkfifo temp1 temp2

Cut data and access groups to draw percentile lines

ぐ巨炮叔叔 提交于 2019-12-11 00:35:49
问题 I'm very new to R so please be gentle. I have a dataset containing timestamps and some data. Now I'd like to draw a graph where: The data is grouped by e.g. 60 mins intervals and some percentile lines are drawn. I'd like to have a graph with the time as x-axis and the gap as y-axis. I imagine something like boxplot but for a better overview - since I have a long measurement - instead of boxes I'd like to have lines that connect the mean values, 3 percentiles, 97 percentiles and 100

how to get awk, cut, etc. to not peek for FS inside quoted strings

天涯浪子 提交于 2019-12-10 19:50:12
问题 I have an input CSV file containing something like: SD-32MM-1001,"100.00",4/11/2012 SD-32MM-1001,"1,000.00",4/12/2012 I need to take out the formatting of numerical values for some other processing pipeline ( postgresql COPY ). Is there a text filter that will separate out the columns on FS without peeking inside quoted strings? Presently I get: $ tail +2 /tmp/foo.csv|awk -F, '{print NF}' 3 4 And similarly partial values for cut I have to stay on Linux. Thanks. 回答1: GNU awk can handle this

Paste Files from Clipboard with Cut or Copy

牧云@^-^@ 提交于 2019-12-10 15:48:13
问题 The .NET Clipboard class has methods to put files into the clipboard and also define if they should be moved or copied (cut/copy). But if I want to paste files that were copied into the clipboard, I see no way to find out if the file was cut or copied with standard Clipboard methods. 回答1: The information is stored in a Clipboard data object named "Preferred DropEffect". A memory stream containing a 4-byte-array contains the enum value for System.Windows.DragDropEffects in the first byte: