Dear Experts,
I have spent my full day looking for the solution..but could no resolved.
Here it goes:
I have a txt file say data.txt. The content is shown below:
**************
datav1
datav2
datav3
***********
I have shown the blank line knowingly. If I open this txt file using emacs, it shows this blank line (as cursor goes there)but this lines go away if I open it using vi editor.
For my purpose this line should either be removed [which mean the cursor should stop at the last line (datav3) only ] or I should put "#" there in the end space line.
I tried "sed". It does work well but not in my case. As it does not recognize this blank line.
with single file, this can be done manually. But I need to handle 50 such files.
any help would be greatly appreciated.
thanks
pooja..
Hi,
Sorry for not using code tags, I just saw the video.
Please find the code here. Strange is I get the same result even if I go there and remove that last line manually.
Still, I am stuck. The C++ code which read this text file duplicate the last entry if I do not remove the blank space manually.
I have to do it manually for 50 files, if I do not get a solution.
pooja..
---------- Post updated at 04:46 PM ---------- Previous update was at 04:38 PM ----------
Please find the code below. One of my friend told me the wayt to check if that line is removed or not is using cat command. And here is the output.
Firstly, I did not remove blank line manually, hence using cat the terminal prompt goes to new line.
Then I opened the file and did it manually and finally again opened it using cat. you can see that the terminal prompt is with the end of the text of the file.
Hi,
It does not help. It does not help. Here is the piece of code:
For me the litmus test is to do
if prompt comes with text (in the same line), then only that blank lines goes away. As you can find in the above code this is not the case.
To make clear what I am saying, here is the Corrected code (corrected manually):
thnaks for prompt replies..
pooja..
Hi there,
I am having this problem:
a) I am uploading a txt file from windows (notepad) with some Gaussian 09 command lines;
b) Gaussian needs in certain command files, that those files have a blank line at the end of the file!
c) I open the command file with vi and no blank line at the of... (2 Replies)
Dear All,
In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read.
For example, consider the extract below:
123
234
543
111... (7 Replies)
Alright, so I was looking around a bit on the forum before posting and still don't really understand so I figured I'd post my own question.
I am appending two files using
cat file_1.txt >> file_2.txt
The problem is that I need a blank line in between the two different text files and it does... (2 Replies)
hi,
i m having a group of files starting with name 'Itemdelete<timestamp>' .
my requirment is to append a blank line at the end of files ,using unix in all the Itemdelete* files with a single unix command without using scripts.can any body put some light to this requiremnt.
regards
Angel (4 Replies)
Hi Guys,
I have a quetion which was already discussed in the forum, but for some reason all approches suggested fail for me.
I have a file which have blank lines at the body of the text as well as at the end. I need to delete ONLY blank lines at the end. Unfortunatly the approach below does not... (5 Replies)
hi,
Does anyone has any idea in adding few blank spaces at the end of every record in a file.
Eg:
file.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
Desired output:-
output.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
I want to add 10 blank spaces at the end every record in file.txt (3 Replies)
Hi Guys,
I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line.
Can you guys help me out?
Regards,
Magesh (9 Replies)
Hi
I nned cmd to which will help me to replace a line in file with blank line
e.g.
file1
a
b
c
d
e
after running cmd I shud get
file1
b
c
d
e (5 Replies)
I am attempting to delete blank lines in my file and I've used this command:
sed '/^$/d' $file > $file.fixed
all this seems to do is copy the file and not delete the blank lines located at the end of the file. Any assistance would be greatly appreciated. (3 Replies)
Hi all
I need to strip blank lines from the end of a file. I have searched and found topics on how to strip lines from the entirety of a file - however I need to limit this to only the last 3-4 lines.
Any ideas?
Thanks (4 Replies)