Sponsored Content
Full Discussion: Cut big text file into 2
Top Forums Shell Programming and Scripting Cut big text file into 2 Post 302321498 by colemar on Monday 1st of June 2009 10:42:52 AM
Old 06-01-2009
Code:
cat bigfile
a
b
c
d potter
e
f pattern
g
h
i
j

grep -n 'p.tter' bigfile
4:d potter
6:f pattern

a=$(grep -n 'p.tter' bigfile)
a=${a%%:*}
echo $a
4

head -$a bigfile
a
b
c
d potter

tail +$((a+1)) bigfile
e
f pattern
g
h
i
j

If you have csplit:
Code:
csplit bigfile '/p.tter/+1'
15
20

cat xx00
a
b
c
d potter

cat xx01
e
f pattern
g
h
i
j

csplit bigfile '/p.tter/+1' '/p.tter/+1'
15
12
8

cat xx00
a
b
c
d potter

cat xx01
e
f pattern

cat xx02
g
h
i
j


Last edited by colemar; 06-01-2009 at 11:52 AM..
 

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
xudced(1)						      General Commands Manual							 xudced(1)

NAME
xudced - user-defined character editor SYNOPSIS
xudced [udc_file [WIDTHxHEIGHT]] DESCRIPTION
xudced is an editor that creates, modifies, and deletes user-defined characters (UDC). It uses bitmap(1) to edit UDC character patterns. Character patterns from existing HP Asian fonts can be modified to create UDCs. xudced runs on the X Window System, Version 11. If udc_file is not specified, the file $HOME/.nlio_udc is read. WIDTHxHEIGHT sets the size of UDC pattern. This can be specified by the udc_width and the udc_height resources. If it is not specified, 24x24 is used. Menu Functions are selected with pull-down menus. To select a function, move the mouse pointer to the menu header. Press and hold the left mouse button. A pull-down menu appears. Drag the mouse pointer down to the desired function and release the mouse button. Functions with the ... suffix invoke a pop-up box that requests further information. The following functions are available: File Open ... Open a file for editing. A pop-up box appears. Enter the file name and the size of the UDC and click OK to display the file. Click Cancel to abort the function. Open font ... Open an HP font and display its contents in another window. A pop-up box appears. Enter the HP font name and click OK to display the font. Click Cancel to abort the function. Save Save UDCs to the file. They are sorted by index number according to the udc(4) format. Exit Exit xudced. If the UDCs have been changed since the last Save, a pop-up box appears. Click yes to save the UDCs before exiting. Click no to exit without saving. Click cancel to abort the function. Edit To edit a particular UDC, move the mouse pointer to the UDC, click the left mouse button, and select an Edit function. These functions can be selected from the Edit menu header, or by clicking and dragging the right mouse button while in the edit window. Cut Remove the selected UDC and store it in the Cut&Paste buffer. Copy Copy the selected UDC to the Cut&Paste buffer. Paste Insert the contents of the Cut&Paste buffer. Delete Remove the selected UDC. Search ... Search a UDC. A pop-up box appears. Enter the index number of the UDC and click OK to search the UDC. Click Cancel to abort the function. Modify pattern ... Invoke bitmap(1) to modify the character pattern of the selected UDC. View Code ... Display the index code and the character pattern for all UDCs in the file. A new window appears that dis- plays the index codes and the character patterns. Click Close to close the window. Cut buffer ... Display the contents of Cut&Paste buffer. A new window appears. Click Close to close the window. Cut&Paste Buffer The contents of the Cut&Paste buffer is shared among windows. Therefore, the Cut, Copy, and Paste functions can be used to move character patterns between windows. X Defaults xudced uses the following resources: background background color. foreground foreground color. font text font. udc_width default width of UDC. udc_height default height of UDC. REMARKS
In Japanese environment, two main windows are invoked. One is for the udc of JIS X 0208 font, and the other is for the udc of JIS X 0212 font. SEE ALSO
bitmap(1), udcc(1), udcload(1), udc(4). xudced(1)
All times are GMT -4. The time now is 03:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy