Strip First few Characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strip First few Characters
# 1  
Old 07-03-2012
Strip First few Characters

I want to strip first few characters from each record until a proper datesamp is found.

Code:
Request for getNextPage.................06/29/12 07:49:30 VVUKOVIC@67.208.166.131{7A805FEF76A62FCBB23EA78B5380EF95.tomcat1}TP-Processor14 LogExchUsage: ERROR:: isprof=false : exch=NSDQ

output should be like
Code:
06/29/12 07:49:30 VVUKOVIC@67.208.166.131{7A805FEF76A62FCBB23EA78B5380EF95.tomcat1}TP-Processor14 LogExchUsage: ERROR:: isprof=false : exch=NSDQ

Is there any way i can use date/timestamp as a field separator in AWK command

Thanks in advance
# 2  
Old 07-03-2012
Code:
perl -pe 's/.*?([0-9]{2}\/[0-9]{2}\/[0-9]{2})/$1/' inputfile

# 3  
Old 07-03-2012
Date as a field separator in awk? Try:
Code:
awk -F'../../..' '{sub($1,x)}1' file

This User Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to strip control-A characters from a column in a file

Hi All, I currently have flat file with 32 columns. The field delimiter is cntl-A ( \x01). The file has been extracted from an oracle table using a datastage job. However, in the 6th field, the data contains additional control -A characters which came as a part of the table data. I need... (12 Replies)
Discussion started by: harsha1238
12 Replies

2. Shell Programming and Scripting

How to strip some characters before putting in array?

Hi Gurus, my current code like below: nawk '{f1 = (NF>1)?$1:""}{print f1, $NF}'|sed -e 's/s(/,/g;s/)//g;s/ *,/,/'|nawk -F"," '{ab}END{for (i in b) if (!(i in a))print i}' I have file like below. (this is autosys job dependencies) the job with s() is dependencies, the job without s() is... (10 Replies)
Discussion started by: ken6503
10 Replies

3. Shell Programming and Scripting

Strip out the string

awk -F"\t" -vOFS="\t" '{print $1"\t-\t-","",$6,$7"\t-"$8"\t-\t-\t"$15}' file.tsv > output.tsv Using the above command how to remove the string www.abc.com from the $7 value. (7 Replies)
Discussion started by: sandy1028
7 Replies

4. Programming

Strip command

I am new in Unix. I go through the man strip. But did not understand that, why when we have -G (debug and release ) option in the compiler, than using strip command to strip the debug information from the objects. i want to binary for teh production i will compile it without debug option. What the... (4 Replies)
Discussion started by: Saurabh78
4 Replies

5. Shell Programming and Scripting

Need to strip few letters

Hey guys.. Can experts help me in achieving my purpose.. I have a file which contains email address of some 100 to 1000 domains, I need only the domain names.. Eg: abc@yahoo.com hd@gamil.com ed@hotmail.com The output should contain only Yahoo.com ... (5 Replies)
Discussion started by: achararun
5 Replies

6. UNIX for Dummies Questions & Answers

Strip characters after the last "/"

Hi, Could anybody please guide how to strip all charaters after the last '/' from a string in a shell script. I have got few strings like "/tmp/oracle/oradata1/abc" or "/var/log/backup/bdfd" and I want to strip anything after the last "/" i.e "abc" and "bdfd" in my case. Thanks, Jamal (3 Replies)
Discussion started by: ahjaeasedqa
3 Replies

7. Shell Programming and Scripting

Need to strip a string

I have a file that looks like this: /home/fred/opt/bin /opt/usr/bin /usr/sbin/var/opt I need a way to chop of everything after the last occurance of the / sign including the /. So the file above will now look like this below. /home/fred/opt /opt/usr /usr/sbin/var I tried using... (6 Replies)
Discussion started by: x96riley3
6 Replies

8. Shell Programming and Scripting

Strip all non-alphanumerics

Hi, Can someone let me know how do I strip out any non-alphanumeric character in string tomake it alphanumeric? i.e abc def ghi ->abcdefghi abc-def-ghi ->abcdefghi abc#def-ghi->abcdefghi Thanks in advance (3 Replies)
Discussion started by: braindrain
3 Replies

9. Shell Programming and Scripting

How to strip strins

Guys, Please can someone tell me how to strip each string from the following ? TABLE1||METHOD||TYPE||STATUS||DATE What i need is to assign each value to the variable TABLE1 to var1 METHOD to var2 and so on If there is NULL in one of them, something like A||B||||C|| I want the... (14 Replies)
Discussion started by: kamathg
14 Replies
Login or Register to Ask a Question