to remove space in a txt file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers to remove space in a txt file
# 8  
Old 01-13-2009
I've edited your post above and added code-tags. Enter the edit more for it too to see what i mean.

Ok so your given example is different to the original file. There are no lines in your file starting with "Started at". I guess there are some blanks or tabs in front of the "Started at". So please post a snippet of your original file but this time with the code tags.
# 9  
Old 01-13-2009
i m still not able to fetch the timestamp
plz help
# 10  
Old 01-13-2009
Do you understand what I wrote?
# 11  
Old 01-13-2009
code:

#!/bin/ksh -x
#***********************************************************************
#
# Program name : ABCD509.ksh
# Description :
#
# Usage :
#
# Pre-cond :
#
# Created By : shweta
# Last Updated :
# Last Reviewed :
# Update History:
# when who what
#***********************************************************************
set -x
+ set -x
echo "${0}: Started at `date`"
+ date
+ echo /home/mkt/scripts/b2b_rpt/ABCD509.ksh: Started at Sat Jan 10 23:29:48 EST 2009
/home/mkt/scripts/b2b_rpt/ABCD509.ksh: Started at Sat Jan 10 23:29:48 EST 2009


this is the file from where i want to capture the first timestamp
# 12  
Old 01-13-2009
are u getting my problem or shld i clearify more
# 13  
Old 01-13-2009
NOW we get your problem (I think). For future reference
  1. Provide us with all the details first instead of having us guess (we aren't telepathic yet)
  2. Use the code tags ([code])
  3. Don't bump up your question, especially if it's only 10 minutes since your last post

Try this
Code:
perl -ne 'print $1 if /:\sStarted at (.*)$/;' input.txt

Besides, shell scripts usually should not include the debug output from an earlier run
# 14  
Old 01-13-2009
Polite is to answer a question when being asked from someone that wants to help you. Since you ignore my simple question, I stop helping you here. Good luck.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove space before numbers in delimited file

Hi, I have a file which looks like this FORD|1333-1| 10000100010203| 100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 I need the output to look like this FORD|1333-1|10000100010203|100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 The leading... (8 Replies)
Discussion started by: wahi80
8 Replies

2. Shell Programming and Scripting

How to remove space and delimit a csv file?

Hi All , I am facing a small challenge i need unix command to remove space as well as replace "|" to "," in a csv file . original file : A | B | c | D E | F | G | H I | J | K | L P | M | N | O Expected o/p: A,B,c,D E,F,G,H I,J,K,L P,M,N,O (4 Replies)
Discussion started by: Sweety532
4 Replies

3. Shell Programming and Scripting

How to remove space from each record in file?

Hi , I want to remove space from each record in one file My file is like BUD, BDL ABC, DDD, ABC ABC, DDD, DDD, KKK The o/p should be BUD,BDL ABC,DDD,ABC ABC,DDD,DDD,KKK Can any one help me regarding this? (9 Replies)
Discussion started by: jagdishrout
9 Replies

4. Shell Programming and Scripting

Remove space in whole file -perl

Hi all, I have a file which have say about 123,000 records, the records in it look like: 1294160401681,05-01-2011 00:00:01,68,Cjw,2,3333,7,1100,900,SUCCESS,200,68,localhost, 1294160406515,05-01-2011 00:00:06,68,Cjw,2,0207,7,1100,900,SUCCESS,200,68,localhost, 1294160410097,05-01-2011... (3 Replies)
Discussion started by: danihamdani
3 Replies

5. Shell Programming and Scripting

Command to remove numbers from beginning of txt file

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt With the... (1 Reply)
Discussion started by: li_bi
1 Replies

6. Shell Programming and Scripting

Export data from DB2 table to .txt file(space delimited)

Hi I need help on this. Its very urgent for me.. please try to help me out.. I have data in tables in DB2 database. I would like to export the data from DB2 tables into a text file, which has to be space delimited. so that I can carry out awk, grep operations on that file. I tried to export... (2 Replies)
Discussion started by: ss3944
2 Replies

7. UNIX for Dummies Questions & Answers

Space in file how to remove

Hello I have a file with data something like this in it : texttexttext "text .lst" TEXT=" text " texttexttext "moretext .lst" TEXT=" text " Question is how do I get rid of space so that the files looks like this : texttexttext "text.lst" TEXT="text" texttexttext... (8 Replies)
Discussion started by: davebw
8 Replies

8. Shell Programming and Scripting

remove space from file content

i am a bit new to shell scripting i have a file containing xxxx xx xx but i want to output the content as xxxxxxxx. thus removing the space. any idea how i can do this (4 Replies)
Discussion started by: blackzinga
4 Replies

9. Shell Programming and Scripting

sed to remove last 2 characters of txt file

sed 's/^..//' file1.txt > file2.txt this will remove the first two characters of each line of a text file, what sed command will remove the last two characters? This is a similar post to my other....sry if I'm being lazy.... I need a file like this (same as last post) >cat file1.txt 10081551... (1 Reply)
Discussion started by: ajp7701
1 Replies

10. Shell Programming and Scripting

remove first column of a space delimited txt

how to remove the first column of a space delimited txt file? there are 12+ columns... what is the cleanest way? could use awk and print all but the first, but it looks kinda ugly awk '{print $2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "$10" "$11" "$12"}' file.txt whats a better way? (1 Reply)
Discussion started by: ajp7701
1 Replies
Login or Register to Ask a Question