Sponsored Content
Full Discussion: Cut big text file into 2
Top Forums Shell Programming and Scripting Cut big text file into 2 Post 302321486 by sandy221 on Monday 1st of June 2009 10:20:12 AM
Old 06-01-2009
Cut big text file into 2

I have a big text file. I want to cut it into 2 pieces at known point or I know the pattern of the contents from where it can separate the files. Is there any quick command/solution?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to cut a text file at a certain spot?

Say I do a date command and get the time from 15 minutes ago. I have a text file with the date printed out every minute or so and I want to cut the file at the date stamp given to me by the 15 minute ago time stamp. Is there an easy way to do this? Example: date +%M gives me 56 I... (2 Replies)
Discussion started by: LordJezo
2 Replies

2. Shell Programming and Scripting

How to cut some data from big file

How to cut data from big file my file around 30 gb I tried "head -50022172 filename > newfile.txt ,and tail -5454283 newfile.txt. It's slowy. afer that I tried sed -n '46467831,50022172p' filename > newfile.txt ,also slow Please recommend me , faster command to cut some data from... (4 Replies)
Discussion started by: almanto
4 Replies

3. Shell Programming and Scripting

Helping in parsing subset of text from a big results file

Hi All, I need some help to effectively parse out a subset of results from a big results file. Below is an example of the text file. Each block that I need to parse starts with "reading sequence file 10.codon" (next block starts with another number) and ends with **p-Value(s)**. I have given... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

4. Shell Programming and Scripting

cut the second line in a text file

Hi I have some problem to cut out the second line in a output file and send to a new file it's a #!/bin/bash script 1 something 2 something 3 something and after I cut 1 something 3 something New file 2 something Thanks in advance (7 Replies)
Discussion started by: pelle
7 Replies

5. UNIX for Dummies Questions & Answers

Cut text from a file

How can I cut the text of definite length say from line no. 20 to 1000? It is trivial ques, but I am very new to Unix. Thanks :) (3 Replies)
Discussion started by: JackR
3 Replies

6. Shell Programming and Scripting

Very big text file - Too slow!

Hello everyone, suppose there is a very big text file (>800 mb) that each line contains an article from wikipedia. Each article begins with a tag (<..>) containing its url. Currently there are 10^6 articles in the file. I want to take random N articles, eliminate all non-alpharithmetic... (14 Replies)
Discussion started by: fedonMan
14 Replies

7. UNIX for Advanced & Expert Users

Help using Awk and cut with a text file

Looking for some help on using awk and cut I have a text file that has fixed information and want to write a script that will prompt the user for an account to search for and pint the output The sample line that has the key information looks like this: Statement to: ... (5 Replies)
Discussion started by: ziggy6
5 Replies

8. UNIX for Dummies Questions & Answers

How to cut a big file into small ones?

Hello all, Currently I have a txt file named as a.txt with the content as: f e100 aa bb cc dd ee ff f e222 aa dd ff gg f e987 dd aa f e2222 gg ff gg aa dd ff ee ee While, for some reason I want to cut a.txt into small ones, e.g. f1.txt, f2.txt, f3.txt and f4.txt. The routine is to... (6 Replies)
Discussion started by: locohd
6 Replies

9. Shell Programming and Scripting

Cut text from a file and remove

Hello Friends, I am stuck with the below problem.Any help will be appreciated. I have a file which has say 100 lines. On the second last line I have a line from which i want to remove certain characters.. e.g CAST(CAST( A as varchar(50)) || ',' || CAST(CAST( B as varchar(50)) || ',' ||... (8 Replies)
Discussion started by: vital_parsley
8 Replies
XCB(1)							      General Commands Manual							    XCB(1)

NAME
xcb - X Cut Buffers - Pigeon holes for your cut and paste selections. SYNOPSIS
xcb [Xt option] [-l layout] [-n count] [-p|-s|-S list] [-r count] DESCRIPTION
Xcb provides easy access to the cut buffers built into every X server. It allows the buffers to be manipulated either via the command line, or with the mouse in a point and click manner. The buffers can be used as holding pens to store and retrieve arbitrary data frag- ments. Any number of cut buffers may be created, so any number of different pieces of data can be saved and recalled later. By default, 8 cut buffers are created. The program is designed primarily for use with textual data. Xcb has two modes of operation. Normally xcb provides an array of windows on your display, one per cut buffer, tiled horizontally, verti- cally, or in some user specified layout. Each window displays the contents of its respective cut buffer. Data can be cut from and pasted to the windows in a similar manner to xterm. The buffers can also be rotated. In task mode, xcb lets you access the cut buffers from the command line. Cut buffers can be loaded from stdin, copied or concatenated to stdout, loaded using the current PRIMARY selection, or rotated an arbitrary number of positions. In this mode of operation, xcb performs the requested task and then exits. It does not create any windows and has no interaction with the mouse or keyboard. OPTIONS
Xcb supports the full set of X Toolkit Intrinsics options, as well as those listed below. Xcb options can appear in any order. The pres- ence of the -p, -r, -s or -S options causes xcb to execute in task mode, described above. -l layout This option controls the geometry arrangement of xcb's subwindows. It is the command line equivalent of the .layout resource, described below. -n count Create count cut buffers. Count can be any integer greater than zero. This option is the command line equivalent of the .buffer- Count resource, described below. -u Use utf-8 instead of the current locale settings when executing in task mode and doing I/O. -V Print the xcb release version number and exit immediately. -p list Print the contents of the listed buffer(s) on stdout. The buffered data is printed exactly as it is stored in the server. Select- ing two or more buffers has the effect of concatenating the data on stdout. The cut buffers are numbered from 0... onwards. The list can be either a single digit, a comma separated list of digits, a range of the form m-n, or some combination of lists and ranges. The buffers are printed in listed order, so repeated numbers in the list can be used to duplicate buffer contents. -r count Rotate the buffers by count positions. Count can be any integer, positive or negative. This option may be used in conjunction with the -n count option to rotate a specific number of buffers. If the -n option is not used, xcb will rotate the number of buffers given by the .bufferCount resource. -s list Store the data from stdin in the listed buffer(s). If the list refers to two or more buffers, the input data is duplicated in each buffer. Refer to the -p option for the definition of a list. -S list Store the current PRIMARY selection data in the listed buffer(s). The data is converted to a string representation. If the list refers to two or more buffers, the PRIMARY selection is duplicated in each buffer. Refer to the -p option for the definition of a list. Under the -S option xcb waits for the nominated cut buffer's contents to change before exiting. If no change is detected within 3 seconds, xcb exits with a non-zero return code. WIDGETS and RESOURCES The xcb widget hierarchy consists of a collection of custom buffer widgets, one per cut buffer. In the Athena version of the program, these buffer widgets are all contained within a single Athena form widget. In the Motif version of the program, they are each enclosed by Motif frame widgets, and the frame widgets are all contained within a single Motif RowColumn widget. The names of the buffer widgets are "buffer0", "buffer1", "buffer2", .... etc., and their class name is "Buffer". Each buffer widget sup- ports all the standard core widget resources, plus the .foreground and .fontSet resources. Application wide resources are as follows: .bufferCount (default value 8) This is the number of buffer widgets to create. Any number of widgets (greater than zero) can be created. .layout (default value "h") Only the first character of the resource value is significant. This is the geometry arrangement to apply in the container widget. The layout can be "h" (horizontal), "v" (vertical), or some other value to disable the inbuilt geometry code and specify the layout via your X resources. An example is provided in the application default resources file. EVENTS and TRANSLATIONS Xcb's input semantics are coded into a Toolkit translation table. The default bindings have been chosen to conform with the default con- figuration of other cut and paste clients, such as xterm. The bindings may be altered or overridden according to your needs. The actions functions provided by xcb are:- cut() causes the contents of the chosen cut buffer to become the PRIMARY selection. The window contents, if any, are highlighted, and can then be pasted into other cut buffers or applications. paste() causes the value of the PRIMARY selection to be converted into text and pasted into the chosen cut buffer, overwriting any previous buffer contents. If no PRIMARY selection is present, xcb pastes the contents of cut buffer zero into the chosen buffer. clear() clears the chosen cut buffer. rotate(NN) rotates the cut buffers by NN positions. NN may be any positive or negative number. refresh() causes the cut buffer window to be cleared and redrawn. selreq() this action function handles paste requests from other clients, or other xcb windows. It should always be bound to SelectionRequest events. selclear() this action function responds to the loss of ownership of the PRIMARY selection property. It should always be bound to SelectionClear events. quit() causes xcb to terminate. The default bindings are as follows:- <Btn1Down>: cut() Shift <Btn2Down>: clear() <Btn2Down>: paste() Shift <Btn3Down>: rotate(-1) <Btn3Down>: rotate(1) <Key>Left: rotate(-1) <Key>Right: rotate(1) <Key>Up: rotate(-1) <Key>Down: rotate(1) <Key>q: quit() <SelReq>: selreq() <SelClr>: selclear() EXAMPLES
The following are some examples of xcb task mode usage:- xcb -s 0-7 < /dev/null This clears the first 8 cut buffers in your server. echo "G'day." | xcb -display bigears:0.0 -s 1,3,5,7 This loads the string "G'day." into four of the cut buffers on the display "bigears". xsendevent -win buffer5 '<Btn1Down>' This uses the program xsendevent to send a synthetic mouse click event to an xcb subwindow, thereby making that window the owner of the PRIMARY selection. ls `xcb -p 2,3` This produces a listing of all the files named in cut buffers 2 and 3. xcb -p 0-7 | xcb -s 0 This concatenates the values in the first 8 cut buffers, and places the result back in cut buffer zero. xcb -S 0 && xcb -p 0 The first command copies the current PRIMARY selection into the first cut buffer. If the copy succeeds, then the second command prints that data on stdout. for i in 0 1 2 3 4 5 6 7 do xcb -p $i > $HOME/.xcb/$i done for i in 0 1 2 3 4 5 6 7 do xcb -s $i < $HOME/.xcb/$i done This first loop saves the contents of each of the cut buffers in a separate file under your home directory. The second loop restores the cut buffer contents from those files. When placed in your .logout and .login scripts respectively, the commands are a simple method of preserving your cut buffers across login sessions. function g { echo "$1\c" | xcb -s 7 grep "$@" } function vg { vi +/`xcb -p 7` "$@" } These two shell functions exemplify a simple mechanism for saving and reusing regular expressions. The first function saves the regex used for grep-ing into cut buffer 7. The second function reuses the most recent grep regex as a search command in vi. There is considerable scope for expanding and improving these ideas. SEE ALSO
xterm(1), xcutsel(1), xclipboard(1), xprop(1) Athena Widget Set - C Language Interface Motif Programmers Reference Guide AUTHORS
Current Maintainer (I18n version) Marc Lehmann E-mail: pcg@goof.com Original Author Farrell McKay E-mail: Farrell.McKay@mpx.com.au XView modifications provided by Danny Vanderryn E-mail: dvanderr@us.oracle.com COPYRIGHT
Copyright (C) 1992,1993,1994 by Farrell McKay. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. This software is provided "as is" without express or implied warranty. BUGS
:-) Xlib's underlying protocol for moving selection data between client and server can sometimes be slow, depending on the amount of data involved. Do not expect fast performance if your selections are big or you want to store big files in your cut buffers! ("big" means, say, over 10k bytes - but your mileage may vary). X Version 11 Oct 6 1994 XCB(1)
All times are GMT -4. The time now is 03:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy