Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cut]

cut is a filter program which extracts fields or columns of each line of input.

1
vote
4answers
99 views

Remove a specific portion of line

I have a csv file that has many lines of timestamps in following format HH:MM:SS:MS For example: 00.00.07.38 00.00.08.13 00.00.08.88 The hour is not relevant to me so I would like to cut it ...
-1
votes
3answers
979 views

How to cut part of a “curl” answer

I have been having a look at this for a while but I haven't found any answer yet. I've got a curl command to send a HTTP POST request to a server, then I have created a script called "tmg.sh" which ...
1
vote
2answers
182 views

Split out data from a column

So at the moment I have some input email addresses and would like to separate the alias and the domain, then copy them to the end of the line. For example, from a line that has something@test.com:blah:...
0
votes
2answers
40 views

Use grep command to read a file from specific line number to end of file

Suppose I have a file which is getting appended in every seconds/minutes. At first time I have read whole file and stored the last line number(eg: last_line_numer was : 2000) later I want to read file ...
0
votes
2answers
43 views

I can't figure out how to cut this file and find unique words of a particular section

So there's an access log entry file named access_log and I'm supposed to find all of the unique files that were accessed on the web server. access_log is formatted like this, this is just an excerpt: ...
-1
votes
2answers
147 views

cut command to extract fields

I want to extract date and time from below sequence /hs_nfs/hsfiq/AXZIP-PP567/was_logs/was_admin_logs/start_WPS.log.04-24-2018-08.36.Apr24.zip:ADMU3000I: Server Node_axzip-pp567_AppClusterMember ...
-1
votes
2answers
341 views

Extracting part of line with using awk or sed

neterrore=connectionFailure&u=https%3A//data.com/callback%3Fcode%3DY6mOqlD2Cghcub29IlDKB7KHFuGCemVeoNr1lF5r6_c%26state%3DcDi00NM8gO8BImQwp1G0gmdIznygTwXQ& In this string I need to extract ...
-1
votes
2answers
69 views

How to Extract Value in File1.csv to File2.csv where Column names are same in both Files

I Have datafile.csv with all columns col1^col2^col3^col4^col5..^up-to col'n' How do I read data of each line in extractfile.csv containing columnName^Value sampleData: Row1: col2^NY col1^2017 ...
2
votes
1answer
73 views

Remove deduplicates in a very large file()

In this given input file, there are 4 columns. We have to remove the duplicates but there is a catch. There is a preference order C2>C3>C4. so in the output there is only one row with a, one row with ...
2
votes
1answer
534 views

Processing timestamps of tcpdump output in realtime

I would like to maintain a file which contains the number of seconds since a packet matching a tcpdump filter has been seen. The aim is to work out when a chatty client is no longer on the network. ...
2
votes
1answer
92 views

Command modification

I'm using the following command to get the highest number of requests per second in a log file and it works well. grep "2017-02-22" "LogFile.log" | cut -c1-20 | uniq -c | sort -n | tail -n1 Now I ...
1
vote
1answer
53 views

Output log lines between startTime and endTime

Given I have log file app.log with contents: 2018-08-29 07:43:17.123-0500 CDT [osb_02] [[ACTIVE] ExecuteThread: '14' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO - [OSB Tracing] Outbound ...
1
vote
1answer
39 views

How to cut specific number without cut all numbers

F gge0006y D 12-30-2006 T 14:05:55 S a69 B 15.3 M gge06001 P 30.6 Q 21.1 R 1006.6 U 1014.6 X 36.1 A 38.994 0 0 G 107.71 0 0 H 8.433 O 36.705 C 7....
1
vote
1answer
44 views

Create a listing of every user which owns a file in a given directory as well as how many files and directories they own

I am having trouble understanding the code : ls -l /projects/ghosttrail | tail -n +2 | sed 's/\s\s*/ /g' | cut -d ' ' -f 3 | sort | uniq -c. Can anybody give me a detailed explanation of what is ...
1
vote
1answer
138 views

Removing columns according to a list in a file

I have a problem with removing columns from a file. input.tsv: Otu1 otu2 otu3 otu4 otu5 1 2 5 9 3 8 9 8 4 2 I would like to remove a column if its header is listed in ...
1
vote
1answer
849 views

I need to merge multiple .csv files together side by side with unequal number of rows

I have anywhere from 3-5 .csv files and need to be able to merge them together while keeping everything in its respective columns below is an easy example with files with varying number of rows. file1 ...
0
votes
1answer
140 views

Transpose 6 columns with other columns identical

I have the file like this... a|b|c|d|e|1|2|3|4|5|f|g|h I need the result as below a|b|c|d|e|1|f|g|h a|b|c|d|e|2|f|g|h a|b|c|d|e|3|f|g|h a|b|c|d|e|4|f|g|h a|b|c|d|e|5|f|g|h Basically I ...
0
votes
1answer
225 views

extract particular substring from a string NOT from file

I have a string like below ,extract_name_is_subscriber_date07232017023012.csv,extract_name_is_subscribers1_date07232017023012.csv is there any way to date only sting from above string like only ...
0
votes
1answer
482 views

Recursive Directory search, Showing most recent file in folder

Can someone point out where am going wrong please. Am doing a directory search (Based on the folder structure and file type) The folder structure is the same for every customer. Just the customer ...
0
votes
1answer
320 views

Cutting logs (and not copying) from a log file between two time stamps

I have a very huge access.log file of 2 Gb containing apache access logs. The date time format in that is as below : 04/May/2015:02:15:25 I want to cut (and not just copy) the logs from this huge ...
0
votes
1answer
81 views

How to find number of unique 'applications' in Debian jessie

This is a follow-up query on allpackages.txt.gz has two different file-sizes? $ wc -l allpackages.txt 57725 allpackages.txt I looked at the output and it says 57725 -6 the header files which is the ...
2
votes
0answers
184 views

use gff2fasta instead of a bash script to get parts of DNA sequences out of a full genome

EDIT and a solution Because my original question was badly phrased and I was trying to re-invent the wheel I am answering my own question now (maybe it helps someone else): gff2fasta is a tool which ...
1
vote
0answers
97 views

Dictionary - synonyms

I have czech czech-finnish dictionary and I have two czech synonyms in one row. Example: záchod (m); toaleta (f) WC; käymälä; miestenhuone; naistenhuone; vessa Synonyms are divided by semicolon and ...
0
votes
0answers
72 views

sed/awk/grep/cut: multiply a number in an xml-attribute by factor of ten

I would like to multiply the attribute in viewBox of svg-files by a factor of ten. I want to change <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" version="1.1"> to <svg xmlns=...