Sponsored Content
Operating Systems Solaris deleting blank space in beginning of line in vi Post 302354893 by Pouchie1 on Sunday 20th of September 2009 09:01:15 PM
Old 09-20-2009
deleting blank space in beginning of line in vi

How can we delete all the blank spaces in the beginning of some lines in a text in vi?

Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting the blank line in a file and counting the characters....

Hi, I am trying to do two things in my script. I will really appreciate any help in this regards. Is there a way to delete a last line from a pipe delimited flat file if the last line is blank. If the line is not blank then do nothing..... Is there a way to count a word that are starting... (4 Replies)
Discussion started by: rkumar28
4 Replies

2. Shell Programming and Scripting

delete blank space in begining of line

Hi All, below is my data file file.txt $$0 ServerA LAN1 AAA IT01 04/30/2008 09:16:26 $$0 ServerB LAN1 AAA IT02 04/30/2008 09:16:26 here $ is a blank space how to delete first 2 blank spaces in a file. (4 Replies)
Discussion started by: karthikn7974
4 Replies

3. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies

4. Shell Programming and Scripting

awk until blank space and print next line

Hello and Happy New Year 2012! I have this example: 1,2,3 4,5,6 7,8,9 For that, I'm trying to get: 1,2,3 4,5,6 7,8,9 for that, I think this might work but doesnt work so far: awk '{for(i=1;i=NF;i++);sub(/\//,"",$i);print $i}' myfile (2 Replies)
Discussion started by: Gery
2 Replies

5. Shell Programming and Scripting

Space at beginning of the line

How can I delete spaces at the begining of all lines of my file ? (2 Replies)
Discussion started by: Sara_84
2 Replies

6. Shell Programming and Scripting

Removing one or more blank characters from beginning of a line

Hi, I was trying to remove the blank from beginning of a line. when I try: sed 's/^ +//' filename it does not work but when I try sed 's/^ *//' filename it works But I think the first command should have also replaced any line with one or more blanks. Kindly help me in understanding... (5 Replies)
Discussion started by: babom
5 Replies

7. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

8. Shell Programming and Scripting

Remove Space and blank line from file in UNIX shell script

I have below file. I want to remove space at begining of every line and then after also remove blank line from file. I use below code for each operation. sed -e 's/^*//' < check.txt > check1.txt sed '/^\s*$/d' < check1.txt > check2.txt above code not remove all the space... (12 Replies)
Discussion started by: Mohin Jain
12 Replies

9. Shell Programming and Scripting

Issue deleting blank line from a file

I'm trying to delete the blank lines from the file $Sfile. tried the below set of commands. Both are giving the same error (: bad interpreter: No such file or directory) awk 'NF > 0' $Sfile > $Tfile cat $Tfile sed -i '/^$/d' $Sfile cat $Sfile Not sure if there's any other problem with... (17 Replies)
Discussion started by: Pandee
17 Replies

10. UNIX for Beginners Questions & Answers

Deleting the last non blank line from a file

PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21 PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21 PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21 PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21 PGW|PGW_CDR_|2017-06-23 141946|2017-07-17... (6 Replies)
Discussion started by: swathi reddy1
6 Replies
FMT(1)							    BSD General Commands Manual 						    FMT(1)

NAME
fmt -- simple text formatter SYNOPSIS
fmt [-cmnps] [-d chars] [-l num] [-t num] [goal [maximum] | -width | -w width] [file ...] DESCRIPTION
The fmt utility is a simple text formatter which reads the concatenation of input files (or standard input if none are given) and produces on standard output a version of its input with lines as close to the goal length as possible without exceeding the maximum. The goal length defaults to 65 and the maximum to 10 more than the goal length. Alternatively, a single width parameter can be specified either by prepend- ing a hyphen to it or by using -w. For example, ``fmt -w 72'', ``fmt -72'', and ``fmt 72 72'' all produce identical output. The spacing at the beginning of the input lines is preserved in the output, as are blank lines and interword spacing. Lines are joined or split only at white space; that is, words are never joined or hyphenated. The options are as follows: -c Center the text, line by line. In this case, most of the other options are ignored; no splitting or joining of lines is done. -m Try to format mail header lines contained in the input sensibly. -n Format lines beginning with a '.' (dot) character. Normally, fmt does not fill these lines, for compatibility with nroff(1). -p Allow indented paragraphs. Without the -p flag, any change in the amount of whitespace at the start of a line results in a new para- graph being begun. -s Collapse whitespace inside lines, so that multiple whitespace characters are turned into a single space. (Or, at the end of a sen- tence, a double space.) -d chars Treat the chars (and no others) as sentence-ending characters. By default the sentence-ending characters are full stop ('.'), ques- tion mark ('?') and exclamation mark ('!'). Remember that some characters may need to be escaped to protect them from your shell. -l number Replace multiple spaces with tabs at the start of each output line, if possible. Each number spaces will be replaced with one tab. The default is 8. If number is 0, spaces are preserved. -t number Assume that the input files' tabs assume number spaces per tab stop. The default is 8. The fmt utility is meant to format mail messages prior to sending, but may also be useful for other simple tasks. For instance, within vis- ual mode of the ex(1) editor (e.g., vi(1)) the command !}fmt will reformat a paragraph, evening the lines. ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of fmt as described in environ(7). SEE ALSO
fold(1), mail(1), nroff(1) HISTORY
The fmt command appeared in 3BSD. The version described herein is a complete rewrite and appeared in FreeBSD 4.4. AUTHORS
Kurt Shoens Liz Allen (added goal length concept) Gareth McCaughan BUGS
The program was designed to be simple and fast - for more complex operations, the standard text processors are likely to be more appropriate. When the first line of an indented paragraph is very long (more than about twice the goal length), the indentation in the output can be wrong. The fmt utility is not infallible in guessing what lines are mail headers and what lines are not. BSD
August 2, 2004 BSD
All times are GMT -4. The time now is 01:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy