I have the following details in a txt file (please note the spaces and tabs)
I wish to convert this file into a .xls file with C1 (all the text under it, included) as Column A, C2 as Column B and C3 as Column C, in the spreadsheet
Example : In Column A, we must have abc,xyx ; pqr ; egf,uvw a in Row 1,2,3 respectively alongwith their respective values in for C2 and C3 in columns B and C respectively
Could you please suggest / help me in this.
Thanks,
Haider
Last edited by Don Cragun; 09-30-2015 at 02:55 PM..
Reason: Add CODE tags for the 2nd time in this post~
I can't see <TAB>s, just spaces; should there be <TAB> field delimiters, why don't you replace those by semicolons and read that file in as a .csv file?
I can't see <TAB>s, just spaces; should there be <TAB> field delimiters, why don't you replace those by semicolons and read that file in as a .csv file?
I tried using code. However, i got a message mentioning about restricted visibility
Adding the code for better understanding
---------- Post updated at 12:57 PM ---------- Previous update was at 12:56 PM ----------
Could you please elaborate your thought with an example.
I have the following details in a txt file (please note the spaces and tabs)
I wish to convert this file into a .xls file with C1 (all the text under it, included) as Column A, C2 as Column B and C3 as Column C, in the spreadsheet
Example : In Column A, we must have abc,xyx ; pqr ; egf,uvw a in Row 1,2,3 respectively alongwith their respective values in for C2 and C3 in columns B and C respectively
Could you please suggest / help me in this.
Thanks,
Haider
You ask us to note spaces and tabs, but you didn't use CODE tags (which are required for us to be able to distinguish tabs and multiple spaces from single spaces). You got an email message and an infraction explaining how to use CODE tags, and Corona688 edited your message to add CODE tags for you. You then edited your post again throwing away the CODE tags Corona688 was nice enough to add for you. I have added them for you again. Please review the following before editing any more of your existing posts or creating any new posts:
Moderator's Comments:
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Then note that there are no tab characters at all in the first post in this thread and note that the spacing in the 1st column of the input you say you have does not match the spacing in your description of the output that follows (is removing the space after the comma accidental or intentional).
You haven't told us what operating system or shell you're using, and some of the things you're trying to do might be easier on some operating systems. Some versions of perl with some add-on packages can produce Microsoft proprietary Excel files, but, as RudiC suggested, you can produce a character separated values file using a semicolon as the field separator and Excel will be able to load your spreadsheet from that file. For example, you could try something like:
or, if you want to get rid of a space after a comma in the 1st field:
If you want to try either of the above on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
This User Gave Thanks to Don Cragun For This Post:
I have written some scripts that resulted in the table below (Column1 is ITEM, Column2 is Group, Column3 is Category and Column4 is Quantity) but I want the output in another format:
Input:
K123 X CATA 3
K123 Y CATA 4
K123 Z CATA 2
K123 X CATB 5
K123 Y CATB 2
K123 Z CATB 2
B65 M CATB... (7 Replies)
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Hello Learned People,
Good evening. I have absolutely no idea as how to do this & I admit that I do not know anything in unix. I must learn this one of these days.
Im a help desk incharge today & someone gave me this file to be formatted & I have a file like this.
vi NewFile.txt
232... (8 Replies)
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
i am running df -k command on aix machine.
i got the output like this. i need to store into file and send that file into microsoft excel.i need to allign properly.
Filesystem 512 blocks Free % Used Iused %Iused Mounted on
/dev/hd4 262144 126488 52% ... (9 Replies)
Hi all,
I have input text file of this format
objectclass:endeavor
pid:12345
postalAddress:379 PROSPECT ST
street:STE B
l:TORRINGTON
st:CT
postalCode:067905238
telephoneNumber:9999999999... (2 Replies)
Dear all,
I have written a program which access database and displays the values returned by the query . There are 10 columns to be displayed in one row. But am ending with 5 lines displayed on 1st line and the next 5 in the 2nd line.
Ex :
21608 10-20-2007 148 Al's Appliance... (7 Replies)
Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date
`top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03
Cpu(s): 3.4% us, 8.5% sy .. ..
Mem: 1011480k total, 226928k used, ....... (4 Replies)
I have a text file that I want a script to parse and grab only the relavent stuff.
No idea where to start..
This is the text file.212 0.00000 ? -> (multicast) ETHER Type=2000 (Unknown), size = 344 bytes
0: 0100 0ccc cccc 000b 5f95 0fbe 014a aaaa ........_....J..... (7 Replies)
below is the output is ls -l
-rw-r--r-- 1 tonyt staff 3212 Apr 17 1999 file1
-rw-r--r-- 1 tonyt staff 4541 Mar 3 21:08 file2
why the date format is not the same? (6 Replies)