Sponsored Content
Full Discussion: How to edit a large file
Top Forums Shell Programming and Scripting How to edit a large file Post 302581956 by y0zh on Wednesday 14th of December 2011 01:20:01 PM
Old 12-14-2011
use VIM instead of VI
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to edit large files using vi

How to edit large file using vi where you can't increase /usr/var/tmp anymore? (3 Replies)
Discussion started by: nazri
3 Replies

2. Shell Programming and Scripting

Help to edit a large file

I am trying to edit a file that has 33k+ records. In this file I need to edit each record that has a 'Y' in the 107th position and change the 10 fields before the 'Y' to blanks. Not all records have a 'Y' in the 107th field. ex: ... (8 Replies)
Discussion started by: jxh461
8 Replies

3. UNIX for Dummies Questions & Answers

Edit the File

Hello Everyone I am new to this forum. I am having a requirement to edit the file(the file is having some sql code). And this file is in my colleagues login. This is readonly Now I would like to edit this file. In which way can I do this? (1 Reply)
Discussion started by: pradkumar
1 Replies

4. Shell Programming and Scripting

how to edit large file in unix

hi All, Plz let me know how to edit a file with 2000000 records. each record contains with 40 field seperated by |. i want modify 455487 record, but i am uable to edit this large file using vi editor in unix. plz let me know how to modify this file. Thanks in advance. -Bali Reddy (3 Replies)
Discussion started by: balireddy_77
3 Replies

5. Shell Programming and Scripting

Edit a large file in place

:confused:Folks, I have a file with 50 million records having 2 columns. I have to do the below: 1. Generate some random numbers of a fixed length. 2. Replace the second column of randomly chosen rows with the random numbers. I tried using a little bit of perl to generate random numbers... (6 Replies)
Discussion started by: mvijayv
6 Replies

6. Shell Programming and Scripting

Edit value in File

I have a file oratab with entry like this SCADAG:/esitst1/oracle/product/9.2.0.8:Y I am trying to discover a way to change the 9.2.0.8 part of this to something like 10.2.0.4 as part of an upgrade script. I have tried cat /etc/oratab >>/tmp/oratab... (1 Reply)
Discussion started by: sewood
1 Replies

7. Shell Programming and Scripting

Scripting the process to edit a large file

Hi, I need to make a script to edit a file. File is a large file in below format Version: 2008120101 ;$INCLUDE ./abc/xyz/Delhi ;$INCLUDE ./abc/xyz/London $INCLUDE ./abc/xyz/New York First line in the file is version number which is in year,month,date and serial number format. Each... (5 Replies)
Discussion started by: makkar4u
5 Replies

8. Shell Programming and Scripting

Script to Edit the file content and create new file

I have a requirement, which is as follows *. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end. *. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Discussion started by: sudesh.ach
1 Replies

9. Shell Programming and Scripting

edit file

I have a file containing dates like below 2010 1 02 2010 2 01 2010 3 05 i want the dates to be like below 20100102 20100201 20100305 i tired using awk '{printf "%s%02s%02s",$1,$2,$3}' But it does not work,it puts all the dates in one line,i want them in seperate lines like the... (6 Replies)
Discussion started by: tomjones
6 Replies

10. UNIX for Advanced & Expert Users

Edit file

Hi All, I have file with 200K Records and each line with 400 character. I need to edit the some part of the file. For example, i need to edit character from 115 to 125, 135to 145 and 344 to 361 Can you please anyone help me to do this? Regards, (1 Reply)
Discussion started by: balasubramani04
1 Replies
Text::FindIndent(3pm)					User Contributed Perl Documentation				     Text::FindIndent(3pm)

NAME
Text::FindIndent - Heuristically determine the indent style SYNOPSIS
use Text::FindIndent; my $indentation_type = Text::FindIndent->parse($text, skip_pod => 1); if ($indentation_type =~ /^s(d+)/) { print "Indentation with $1 spaces "; } elsif ($indentation_type =~ /^t(d+)/) { print "Indentation with tabs, a tab should indent by $1 characters "; } elsif ($indentation_type =~ /^m(d+)/) { print "Indentation with $1 characters in tab/space mixed mode "; } else { print "Indentation style unknown "; } DESCRIPTION
This is a module that attempts to intuit the underlying indent "policy" for a text file (most likely a source code file). METHODS
parse The class method "parse" tries to determine the indentation style of the given piece of text (which must start at a new line and can be passed in either as a string or as a reference to a scalar containing the string). Returns a letter followed by a number. If the letter is "s", then the text is most likely indented with spaces. The number indicates the number of spaces used for indentation. A "t" indicates tabs. The number after the "t" indicates the number characters each level of indentation corresponds to. A "u" indicates that the indenation style could not be determined. Finally, an "m" followed by a number means that this many characters are used for each indentation level, but the indentation is an arbitrary number of tabs followed by 0-7 spaces. This can happen if your editor is stupid enough to do smart indentation/whitespace compression. (I.e. replaces all indentations many tabs as possible but leaves the rest as spaces.) The function supports parsing of "vim" modelines. Those settings override the heuristics. The modeline's options that are recognized are "sts"/"softtabstob", "et"/"noet"/"expandtabs"/"noexpandtabs", and "ts"/"tabstop". Similarly, parsing of "emacs" Local Variables is somewhat supported. "parse" use explicit settings to override the heuristics but uses style settings only as a fallback. The following options are recognized: "tab-width", "indent-tabs-mode", "c-basic-offset", and "style". There is one named option that you can pass to "parse()": "skip_pod". When set to true, any section of POD (see perlpod) will be ignored for indentation finding. This is because verbatim paragraphs and examples embedded in POD or quite often indented differently from normal Perl code around the POD section. Defaults to false. Example: my $mode = Text::FindIndent->parse($text, skip_pod => 1); to_vim_commands A class method that converts the output of "parse($text)" into a series of vi(m) commands that will configure vim to use the detected indentation setting. Returns zero (failure) or more lines of text that are suitable for passing to "VIM::DoCommand()" one by one. As a convenience, if the argument to "to_vim_commands" doesn't look like the output of "parse", it is redirected to "parse" first. To use this, you can put the following line in your .vimrc if your vim has Perl support. Suggestions on how to do this in a more elegant way are welcome. The code should be on one line but is broken up for displaying: map <F5> <Esc> :perl use Text::FindIndent;VIM::DoCommand($_) for Text::FindIndent->to_vim_commands(join " ", $curbuf->Get(1..$curbuf->Count()));<CR> (Patches to implement the equivalent for emacs would be welcome as well.) SUPPORT
Bugs should be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-FindIndent> For other issues, contact the author. AUTHOR
Steffen Mueller <smueller@cpan.org> Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2008 - 2010 Steffen Mueller. Copyright 2008 - 2010 Adam Kennedy, This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.10.1 2011-01-04 Text::FindIndent(3pm)
All times are GMT -4. The time now is 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy