Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all,
here i am attaching two input files as well as two output files,can you guys please give me the script for these files
INPUT(1)- "23 Aug 2012 12:15:09 IST","Aug 23 12:13:45 AX2500 CAT-TDP-N: 192.168.10.2:6465400 <-->147.234.242.96:4435,147.234.242.96:4435 <-->182.19.88.230:6465400
OUTPUT(1)- 23 August 2012 12:13:45|AX2500|CAT-TDP-N|192.168.10.2|6465400|182.19.88.230|147.234.242.96|4435
INPUT(2)<134> Aug 23 12:13:46 AX2500 CAT-TDP-D: 192.168.10.2:569<-->8.8.8.8:533, 8.8.8.8:533<-->182.19.88.230:569
OUTPUT(2)- 134|23 Aug 2012 12:13:46|AX2500|CAT-TDP-D|192.168.10.2|8.8.8.8|533|182.19.88.230|569|
Um... You mean you want a script to convert the input into the output? The two files don't have a common format, how do you expect a script to do the conversion?
Um... You mean you want a script to convert the input into the output? The two files don't have a common format, how do you expect a script to do the conversion?
i need two different scripts for two input files to convert as output file..
i.e script 1 and script 2
Ah I see. Well, you'll probably want to be looking at something like perl, ruby or python - you might just be able to do it with awk, but I don't think it'd be pretty.
i need two different scripts for two input files to convert as output file..
i.e script 1 and script 2
Ok. Can you post what you've written/tried so far, and tell us where you're stuck?? We'll be glad to help, but we won't write your scripts for you. There are MANY thousands of scripting tutorials you can find via Google, if you looked.
Just by looking at what you posted, you can use sed to replace characters easily, so that could remove the "< >" characters, and replace the commas with "|" characters too. A simple compare in your shell script can look for "Aug" and output August instead, or you could also do that with sed as well, depending on how simple you want to keep things.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.