Execution problem ---to remove the lines which starts with one type of character
Hi, I have one file, I need to check if file exist or not and then remove the lines which starts with ?
My file1.out data is some thing
Output should be in test.out
I am getting the output as below but the File does not exist in the directory..
I can see FN: is displayed in quotes "File1.out", Can some one please tell me what is wrong in this
I have written the following Code
==========================================
Output for the above code
=============================================
If i declare this way
out put is
If i declare this way I am getting File Exist,
but after this i need to search for the lines which start with ? and remove them and write to new file
Can some one please tell me how to do this.
Last edited by Scrutinizer; 06-07-2012 at 10:24 AM..
Reason: code tags
My version is
$ cat /proc/version
Linux version 2.6.32-100.26.2.el5 (mockbuild@ca-build10.us.oracle.com)
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Jan 18 20:11:49 EST 2011
Mabe try an echo "$*" at the top of the script so we can see what parameters were used to call the script. I'm wondering of your database is using a different character set from your Shell, or perhaps your tr command doesn't work?
Note that test -s checks that the file exists AND is not empty. You would need test -f to just check whether the file exists.
In the end it is probably going to be easier to fix the program which writes the data file.
Hi,
I came across one issue recently where output from one of the columns of the table from where i am creating input file has newline characters hence, record in the file is spread over multiple lines. Fields in the file are separated by pipe (|) delimiter. As header will never have newline... (4 Replies)
I have a file like below
#Fields section bald
1234 2345 456 222
abcs dddd dddd ssss
mmmm mmm mmm
i need do not process a files stating with #
I was written code below
while read -r line
do
if
then
echo ${line} >>
elif
then
... (3 Replies)
I have requirement in my every files starting lines have # needs to be not processing or exclude the that lines.
I have written a code like below, but now working as expected getting ERROR" line 60:
1 #!/bin/sh
2 echo ======= LogManageri start ==========
3
4 #This directory is... (1 Reply)
I want to remove commands having no output. In below text file.
bash-3.2$ cat abc_do_it.txt
grpg10so>show trunk group all status
grpg11so>show trunk group all status
grpg12so>show trunk group all status
GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Hi,
I have a file that looks like this, the unity of information is composed of four lines, and these extends for millions.
My objective is to remove the highligthed "T".
How to attack this? This character is always constant in type "T" and position "1st" but the rest of the line is... (7 Replies)
hiiiii
$ grep ^"#" $file
Will give the lines , which starts with # .And I wanna get the lines which are not starting with #.
How to implement that.
Thanking you
Krish:b: (10 Replies)
I have a '~' delimited file of 6 - 7 million rows. Each row should contain 13 columns delimited by 12 ~'s. Where there are 13 tildes, the row needs to be removed. Each row contains alphanumeric data and occasionally a ~ ends up in a descriptive field and therefore acts as a delimiter, resulting... (7 Replies)
I have a file with a few thousand lines and I'd like to remove all the lines that have more than 1 asterik (the * character) in it. So if it has 2 or more in a single line, I'd like the line removed (double d command in vi) (12 Replies)