Sponsored Content
Full Discussion: Editing long text file
Top Forums UNIX for Dummies Questions & Answers Editing long text file Post 302974710 by bakunin on Thursday 2nd of June 2016 12:43:23 PM
Old 06-02-2016
Usually "thousands" of lines is not a problem for vi. Maybe you have simply not enough space in the right place: upon start vi creates a (temporary) working copy of the file it works on, usually in /var/tmp. If this is the problem you can either increase the filesystem in size or configure vi to use another location for its temporary files. How this is done depends on your vi implementation, but the man page will surely help.

If indeed vi is not working for you you might consider sed, if the changes you intend to make can be automated.

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Text Editing

Hello everybody, I have a sorted text file. some of the lines appear twice or even more. is there an unix utility that removes the extra appearences? Thanks, Ido. (7 Replies)
Discussion started by: ginodii
7 Replies

2. Shell Programming and Scripting

How do I strip and add tabbed fields to a long text file?

I was wondering if there was a way to modify a tab delimited text file, up to 185,000 lines long by adding a repeated field to a block of 20 data , then repeat the process until the file is processed. The current file looks like: ... (3 Replies)
Discussion started by: saint65
3 Replies

3. Shell Programming and Scripting

text file editing

Hi, I need some help in text manipulation. I have an input file like this: 7629 "WPCW 19 - CW/AM1, WPCB 40 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER, " W35AW - Various Shopping Pgms W41CF - TBN W47CV - TBN WLLS-LP 49 - AM1 WATCH WPXI 11 N & WPIX 11 CW 1234 "WPCW 19 - CW/AM1,... (26 Replies)
Discussion started by: injeti
26 Replies

4. Shell Programming and Scripting

Editing long records with characters that need to be escaped.

Hi all, I'm new in unix scripting and I've a problem with a script... :confused: I need to read a file, add some fields in the records, and write them in another file, but even when I simply read and write the records, the shell interprets some caracters and the result is that the records... (5 Replies)
Discussion started by: Macs_Linux
5 Replies

5. Shell Programming and Scripting

Text editing script does everything but edit text.

I wrote this script to create and edit a large number of websites based on a template site and a collection of text files which have the relevant strings in them delimited by colons. I run it and the shell doesn't produce any errors, but when it gets to the for loop where it actually has to edit... (2 Replies)
Discussion started by: afroCluster
2 Replies

6. Programming

Editing a specific liine of text file - C++

Is there any way to erase all the contents of a specific line of a text file and then write something on it? e.g. test.txt.old: qwert asdfg zxcbv=0 test.txt.new qwerty asdfg hello=0 is this possible with C++ ?:confused: (1 Reply)
Discussion started by: hakermania
1 Replies

7. Shell Programming and Scripting

editing line in text file adding number to value in file

I have a text file that has data like: Data "12345#22" Fred ID 12345 Age 45 Wilma Dino Data "123#22" Tarzan ID 123 Age 33 Jane I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes: Data "1012345#22" Fred ID... (16 Replies)
Discussion started by: say170
16 Replies

8. Shell Programming and Scripting

Help needed editing text file using the terminal

Hi, I have text file with the header like this tracking_id condition replicate FPKM XLOC_000001 alpha 1 10.3199 XLOC_000001 alpha 0 10.3686 XLOC_000001 alpha 2 15.5619 ... With the first column being genes, the second being the condition, the third... (5 Replies)
Discussion started by: 4galaxy7
5 Replies

9. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies
xfs_fsr(8)                                                    System Manager's Manual                                                   xfs_fsr(8)

NAME
xfs_fsr - filesystem reorganizer for XFS SYNOPSIS
xfs_fsr [-v] [-t seconds] [-f leftoff] [-m mtab] xfs_fsr [-v] [xfsdev | file] ... DESCRIPTION
xfs_fsr is applicable only to XFS filesystems. xfs_fsr improves the organization of mounted filesystems. The reorganization algorithm operates on one file at a time, compacting or oth- erwise improving the layout of the file extents (contiguous blocks of file data). The following options are accepted by xfs_fsr. The -m, -t, and -f options have no meaning if any filesystems or files are specified on the command line. -m mtab Use this file for the list of filesystems to reorganize. The default is to use /etc/mtab. -t seconds How long to reorganize. The default is 7200 (2 hours). -f leftoff Use this file instead of /var/tmp/.fsrlast to read the state of where to start and as the file to store the state of where reorganization left off. -v Verbose. Print cryptic information about each file being reorganized. When invoked with no arguments xfs_fsr reorganizes all regular files in all mounted filesystems. xfs_fsr makes many cycles over /etc/mtab each time making a single pass over each XFS filesystem. Each pass goes through and selects files that have the largest number of extents. It attempts to defragment the top 10% of these files on each pass. It runs for up to two hours after which it records the filesystem where it left off, so it can start there the next time. This information is stored in the file /var/tmp/.fsrlast_xfs. If the information found here is somehow inconsistent or out of date it is ignored and reor- ganization starts at the beginning of the first filesystem found in /etc/mtab. xfs_fsr can be called with one or more arguments naming filesystems (block device name), and files to reorganize. In this mode xfs_fsr does not read or write /var/tmp/.fsrlast_xfs nor does it run for a fixed time interval. It makes one pass through each specified regular file and all regular files in each specified filesystem. A command line name referring to a symbolic link (except to a file system device), FIFO, or UNIX domain socket generates a warning message, but is otherwise ignored. While traversing the filesystem these types of files are silently skipped. FILES
/etc/mtab contains default list of filesystems to reorganize. /var/tmp/.fsrlast_xfs records the state where reorganization left off. SEE ALSO
xfs_fsr(8), mkfs.xfs(8), xfs_ncheck(8), xfs(5). NOTES
xfs_fsr improves the layout of extents for each file by copying the entire file to a temporary location and then interchanging the data extents of the target and temporary files in an atomic manner. This method requires that enough free disk space be available to copy any given file and that the space be less fragmented than the original file. It also requires the owner of the file to have enough remaining filespace quota to do the copy on systems running quotas. xfs_fsr generates a warning message if space is not sufficient to improve the target file. A temporary file used in improving a file given on the command line is created in the same parent directory of the target file and is pre- fixed by the string '.fsr'. The temporary files used in improving an entire XFS device are stored in a directory at the root of the target device and use the same naming scheme. The temporary files are unlinked upon creation so data will not be readable by any other process. xfs_fsr does not operate on files that are currently mapped in memory. A 'file busy' error can be seen for these files if the verbose flag (-v) is set. Files marked as no-defrag will be skipped. The xfs_io(8) chattr command with the f attribute can be used to set or clear this flag. Files and directories created in a directory with the no-defrag flag will inherit the attribute. An entry in /etc/mtab or the file specified using the -m option must have the rw option specified for read and write access. If this option is not present, then xfs_fsr skips the filesystem described by that line. See the fstab(5) reference page for more details. In general we do not foresee the need to run xfs_fsr on system partitions such as /, /boot and /usr as in general these will not suffer from fragmentation. There are also issues with defragmenting files lilo(8) uses to boot your system. It is recommended that these files should be flagged as no-defrag with the xfs_io(8) chattr command. Should these files be moved by xfs_fsr then you must rerun lilo before you reboot or you may have an unbootable system. xfs_fsr(8)
All times are GMT -4. The time now is 03:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy