Sponsored Content
Top Forums Shell Programming and Scripting Two Input Lines Into Single Output Line (CSV) Post 302541443 by svermill on Sunday 24th of July 2011 04:27:43 PM
Old 07-24-2011
Ah, one mystery solved and a new one introduced!

Your above abbreviated code led me to a discovery. It printed the very first hostname and then threw me an error on the very next file, which is something akin to "batchfile.txt." This is obviously not output from my TCL/Expect script, but rather is a big long list of TCL commands and Expect interactive stuff that I paste into my TCL shell to create all of the .txt files I'm performing post-analysis on with these new scripts you have helped me to create. At the end of every one of those TCL commands is something like "router1.txt," which is precisely what creates the .txt files with an embedded hostname in the file. Not sure how, but that was clearly a problem for xargs. I converted all non-router/switch text files to a .xtx extension and then ran the script and now I have something more along the lines I was hoping for. HOWEVER... Smilie

My output file right now is "out5.txt." Towards the very end of this file, I actually see an entry of "out5" as if it were a hostname, and then a very VERY long comma-separated line of 'ntp server' and 'ntp peer' strings. So somehow the script is actually catching up to itself before it completes. Right? I suppose I can just exclude output file from being evaluated as input, no?

---------- Post updated at 02:27 PM ---------- Previous update was at 02:00 PM ----------

Just dawned on me that I had stopped using .csv in my output file so that I wouldn't have to do "Open With" and could just open it directly in my text editor. I will, however, go back to .csv for production stuff and then this simply wouldn't be an issue! Smilie

OK, time for a nice cold beer! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need output in different lines not in one single line

I am getting the coutput like this as show below in one single line, where as the command is executed is several lines and the output should also be requied in several lines, not in one single line. Anyone any idea? p4 opened -a | grep *locked* | awk '{ printf $8 }' >/tmp/aa $ cat... (1 Reply)
Discussion started by: csaha
1 Replies

2. Shell Programming and Scripting

single line input to multiple line output with sed

hey gents, I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies

3. Shell Programming and Scripting

Break lines up into single lines after each space in every line

It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space. Example of text file; line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies

4. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

5. Shell Programming and Scripting

Input two variable on single line

Can we input two variable on single line that separate by space example user input "list jpg" it will list all jpg files in current directory (3 Replies)
Discussion started by: guidely
3 Replies

6. Shell Programming and Scripting

turning output of two lines into one CSV line

Hi, I am attempting to use sed on linux to do something trivial. I am also too embarassed to show you what I have tried so far! What I am trying to do should be trivial, if I knew what I was doing, but I don't. Would someone please help me? Here is my problemI have a ASCII file that has the... (4 Replies)
Discussion started by: Jon8987z
4 Replies

7. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

8. Shell Programming and Scripting

How do I split a single-line input into five lines?

Example input: John:Shepherd:770-767-4040:U.S.A:New York Mo Jo:Jo Jo: 666-666-6666:U.S.A:Townsville Expected Output: First Name: John Last Name: Shepherd Phone Number: 770-767-4040 Country: U.S.A State: New York First Name: Mo Jo Last Name: Jo Jo Phone Number: 666-666-6666... (10 Replies)
Discussion started by: Camrikron
10 Replies

9. Shell Programming and Scripting

ksh - Read input from file and output CSV i same row

Hello I have the following output and want the output to look: FROM: GigabitEthernet0/0 is up, line protocol is up 1 input errors, 0 CRC, 0 frame, 1 overrun, 0 ignored 275 output errors, 0 collisions, 3 interface resets GigabitEthernet0/1 is up, line protocol is up 0... (4 Replies)
Discussion started by: JayJay2018
4 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
httpindex(1)						      General Commands Manual						      httpindex(1)

NAME
httpindex - HTTP front-end for SWISH++ indexer SYNOPSIS
wget [ options ] URL... 2>&1 | httpindex [ options ] DESCRIPTION
httpindex is a front-end for index++(1) to index files copied from remote servers using wget(1). The files (in a copy of the remote direc- tory structure) can be kept, deleted, or replaced with their descriptions after indexing. OPTIONS
wget Options The wget(1) options that are required are: -A, -nv, -r, and -x; the ones that are highly recommended are: -l, -nh, -t, and -w. (See the EXAMPLE.) httpindex Options httpindex accepts the same short options as index++(1) except for -H, -I, -l, -r, -S, and -V. The following options are unique to httpindex: -d Replace the text of local copies of retrieved files with their descriptions after they have been indexed. This is useful to display file descriptions in search results without having to have complete copies of the remote files thus saving filesystem space. (See the extract_description() function in WWW(3) for details about how descriptions are extracted.) -D Delete the local copies of retrieved files after they have been indexed. This prevents your local filesystem from filling up with copies of remote files. EXAMPLE
To index all HTML and text files on a remote web server keeping descriptions locally: wget -A html,txt -linf -t2 -rxnv -nh -w2 http://www.foo.com 2>&1 | httpindex -d -e'html:*.html,text:*.txt' Note that you need to redirect wget(1)'s output from standard error to standard output in order to pipe it to httpindex. EXIT STATUS
Exits with a value of zero only if indexing completed sucessfully; non-zero otherwise. CAVEATS
In addition to those for index++(1), httpindex does not correctly handle the use of multiple -e, -E, -m, or -M options (because the Perl script uses the standard GetOpt::Std package for processing command-line options that doesn't). The last of any of those options ``wins.'' The work-around is to use multiple values for those options seperated by commas to a single one of those options. For example, if you want to do: httpindex -e'html:*.html' -e'text:*.txt' do this instead: httpindex -e'html:*.html,text:*.txt' SEE ALSO
index++(1), wget(1), WWW(3) AUTHOR
Paul J. Lucas <pauljlucas@mac.com> SWISH++ August 2, 2005 httpindex(1)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy