File handling in the VI editor


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File handling in the VI editor
# 1  
Old 01-06-2010
File handling in the VI editor

hi,

I am working in sun solaris.

while extracting a file from another environment and storing in unix.The extracted files have lines cut inbetween and the remaining lines comes in a new line.

Is there any command which would let me change this feature?i know there is a line limit in unix, but can i set the file so that it can be cut after a space and not in a word half way.
# 2  
Old 01-06-2010
I am not sure which "line limit in unix" you are talking about .
There is no such limit *inside* the files . The only limit I am aware of is command line length in shell .
# 3  
Old 01-06-2010
the error i am getting is certainly because, max length of lines is 74 characters and the remaining comes in a new line.


I am not sure if the error could be because of some other reason.
# 4  
Old 01-06-2010
are you sure that you are talking about "real" new line inside the text ?
It seems you are talking about visual representation .
do :
tput cols
If the result is 74 or near it - we have visual representation problem here and you just need to change terminal size to 132x24 or whatever to see the rest of the line .
# 5  
Old 01-06-2010
tput cols gives me 125.

also in the case of visual representation problem, would not a single line appear as more than 1 line? in my case i see 'end of line ($)' half way through and remaining in a new line.

the file i am extracting is a from a database (teradata) , i run the queries and store the result in unix. so a large line in teradata is split as multiple lines in unix . which i would like to avoid, or cut after a space, and not split in the middle of a word.

---------- Post updated at 03:01 PM ---------- Previous update was at 02:51 PM ----------

Could i edit my file after is extracted so that i can move lines after certain length and merge with next line?
# 6  
Old 01-06-2010
J will merge 2 lines .
Go to the end of line , press J and next line will be appended .
I am not sure you want to do it for large file manually .
# 7  
Old 01-06-2010
I certainly do not want to do this manually Smilie the file is a big one.

i rectifed certain critical files using 'J' but i need a better method to handle this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File handling

Hi All, I need to extract the data from the text file. The data of the text file is shown below #L 0.000017 4.329939 0.000017 4.716267 r7.9 P 1 1;Net=IN32 The extracted data should be IN32. Could anyone help to script in c shell.? (4 Replies)
Discussion started by: gopishrine
4 Replies

2. UNIX for Dummies Questions & Answers

File handling

I have a file 1 298167 298168 1093209 1093210 1422663 I want to write a code where in I want to read contents of above file like first read is 1 second read is 298167 Substract second read from first and if this is greater than or less than 99,999. Similarly I want to traverse thru... (3 Replies)
Discussion started by: Guru148
3 Replies

3. UNIX for Dummies Questions & Answers

File Handling

Hi Team, I am trying to cut a large file into multiple files. It has Header 50,050 records Trailer ------------------------------------------- I need to cut the files into multiple files of 1000 records and should have the same header and trailer as the original files. ... (4 Replies)
Discussion started by: Gurkamal83
4 Replies

4. Shell Programming and Scripting

UNIX File handling -Issue in reading a file

I have been doing automation of daily check activity for a server, i have been using sqls to retrive the data and while loop for reading the data from the file for several activities. BUT i got a show stopper the below one.. where the data is getting store in $temp_file, but not being read by while... (1 Reply)
Discussion started by: KuldeepSinghTCS
1 Replies

5. UNIX for Advanced & Expert Users

File handling

my input for a script is another csv file but in that file say 7 lines are there ... how can i get line by line to that input for example : >cat link.csv www.yahoo.com,yahoo www.google.com,google www.unix.com,unix another file in that file i need to ping the above links ... (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. UNIX for Advanced & Expert Users

please help me in file handling

sir i have to get first line from a file for example >cat file1 abc zxc asd adsf from that file1 i need only first line expected result >abc please help me ! (1 Reply)
Discussion started by: ponmuthu
1 Replies

7. UNIX for Advanced & Expert Users

File Handling

Hi, I have a log file which runs into 3 to 5 GB. We store this typically for 6 months. When a new month starts we move the previous month into a 9 month back up log (file.9m) and delete the last month of the 9 month back up. Iam using awk to find the data and cat to join the files like... (3 Replies)
Discussion started by: baanprog
3 Replies

8. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set... (6 Replies)
Discussion started by: aarora_98
6 Replies

9. Programming

file handling

Hi all, I got a little issue here. Imagine that I have more than one process accessing one file. Is it possible to know which process(es) are accessing that file when I open the file?? Thanks for the help. Best regards, Ernesto (2 Replies)
Discussion started by: ninjanesto
2 Replies

10. Programming

File Handling in C

Hi all, I have a problem in handling files through C. here is the problem im having: i will query the database (for instance consider employees table ) for empno,ename,job,salary fields.The query returns me some 100 of rows. now i need to place them in a file in row wise pattern as they... (3 Replies)
Discussion started by: trinath
3 Replies
Login or Register to Ask a Question