Command to print columns with space


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command to print columns with space
# 8  
Old 03-07-2017
My apologies about the code tags - will make sure I do that moving forward.. Thank you..

---------- Post updated at 01:48 PM ---------- Previous update was at 01:39 PM ----------

Thank you for replying..

Actually not really scripting isn't my strong suite - continuously trying to learn and understand..

As for is it dashes or underscore, they are from the first line of the input file which were headers.. In a previous step that populates the OUTFILE2 I exclude some items but it left the dashes or underscores of the header..

General text:

Here is the output from the script:
Dash's
Code:
vserver cifs share create -vserver ------------- -share-name ---------- -path ----

Blank line:
Code:
vserver cifs share create -vserver

Input file looks something like this:

Code:
vserver share-name path 
 ------------- ---------- ---- 
 SVM_A   admin$ /

I am able to delete the first line by omitting share-name but the dashes or underscore still appear..



Moderator's Comments:
Mod Comment Didn't you say: "code tags - will make sure I do that moving forward"?
Please use CODE tags as required by forum rules!



My apologies - I didn't consider those lines code because they are just general text.. I will make it code moving forward..

Last edited by fmalvest; 03-07-2017 at 03:06 PM.. Reason: Added CODE tags.
# 9  
Old 03-07-2017
So there are two header lines. In that case you could modify my suggestion like this:
Code:
{
  read; read                     # skip header lines

# 10  
Old 03-07-2017
It might well be that my arithmetics is a bit weird, but I see the dashes in line 2. This is not what Scrutinizer allowed for - his code will eliminate vserver share-name path but NOT the dashes. And, the "blank line" might NOT be empty if the code does not eliminate it.
So - what do you want to do - suppress both lines? Print line1, suppress line2? What's in the last, "blank" line?
# 11  
Old 03-07-2017
The 1st line is the first line in the input file.. The blank line is the last line of the input file - has about 200 lines total.. I remove the words from the 1st line but the dashes or underscores are still there.. The blank line is also there as well..

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use "awk" to print columns from different files in separate columns?

Hi, I'm trying to copy and paste the sixth column from a bunch of files into a single file having each column pasted in separate columns (and not one after each other in just one column.) I tried this code but works only partially because it copied and pasted 50 rows of each column... (6 Replies)
Discussion started by: Frastra
6 Replies

2. Shell Programming and Scripting

Romove columns and replace a space with a character

Hi, I have a file containing this: testvol1 unix enabled testvol2 unix enabled testvol3 unix enabled testvol3 qtree1 unix enabled testvol3 qtree2 unix enabled testvol4 unix enabled testvol4 qtree1 unix enabled And I want an output of this: testvol1... (4 Replies)
Discussion started by: niap21
4 Replies

3. Shell Programming and Scripting

Columns to rows with space

Hi, My input is in the following way a b c d e f I would like to have it printed as a b c d e f Any awk scripts are appreciated. (1 Reply)
Discussion started by: jacobs.smith
1 Replies

4. UNIX for Dummies Questions & Answers

help needed: remove space between certain columns

dear all, i have a data looks like this (i have 3000 columns): rs123 A T T G C C C C C C A A A A A A A A A A A ... rs154 T T G C C C C C A A A A A A A A A A T T G ... rs126 A C C C C C A A A A A A A A A A A A T T G ... I want to remove all the space after the 2nd column and make the... (2 Replies)
Discussion started by: forevertl
2 Replies

5. Shell Programming and Scripting

awk command to print multiple columns

Hello Team, I have written following command which is giving output is as shown below. bash-3.00$ grep -i startup catalina.out | tail +2 | sed -n 1p | awk -F" " '{ for (x=1; x<=5; x++) { printf"%s\n", $x } }' Dec 19, 2010 3:28:39 PM bash-3.00$ I would like to modify above command to... (2 Replies)
Discussion started by: coolguyamy
2 Replies

6. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

7. Shell Programming and Scripting

Single command for add 2 columns and remove 2 columns in unix/performance tuning

Hi all, I have created a script which adding two columns and removing two columns for all files. Filename: Cust_information_1200_201010.txt Source Data: "1","Cust information","123","106001","street","1-203 high street" "1","Cust information","124","105001","street","1-203 high street" ... (0 Replies)
Discussion started by: onesuri
0 Replies

8. Shell Programming and Scripting

help with delimiting columns with a space

Hi all, i am writting a script to fix some problems we have with data that we need that contains 1000s of records. I have a text file with 3 columns of data. The problem is there should be a space between the end of the first column and the start of the second column. The majority of the data is... (7 Replies)
Discussion started by: borderblaster
7 Replies

9. HP-UX

How to add space in between columns in VI editor

Hi, I am trying to add space after 3rd and 6th column for editing a file in special format. How should I achieve in VI?. So, is it possible to do in it in sed ? thanks vipa (1 Reply)
Discussion started by: vipas
1 Replies

10. Shell Programming and Scripting

Trying to space columns in a report

I have a program that calculates shipping cost for an item and prints the information to a file. I cannot seem to get the lines to print with equal spacing in columns. I need data like this to be aligned into columns: Optical Mouse 5 A $25 Compaq Presario 3... (2 Replies)
Discussion started by: turbulence
2 Replies
Login or Register to Ask a Question