Sponsored Content
Top Forums Shell Programming and Scripting Adding blank white sapce at specific column Post 302130733 by Shell_Life on Tuesday 7th of August 2007 03:24:37 PM
Old 08-07-2007
Code:
#!/bin/ksh
typeset -L2 mTwo
typeset -L4 mFour
sed 's/ //g;s/\./ /g' input_file | \
while read m1 m2 m3 m4 m5 m6 m7 m8 m9 m10
do
  mTwo=${m2}
  mF1=${m1}'.'${mTwo}

  mTwo=${m3}
  mF2=`echo ${m2} | cut -c3-`'.'${mTwo}

  mTwo=${m4}
  mF3=`echo ${m3} | cut -c3-`'.'${mTwo}

  mTwo=${m5}
  mF4=`echo ${m4} | cut -c3-`'.'${mTwo}

  mTwo=${m6}
  mF5=`echo ${m5} | cut -c3-`'.'${mTwo}

  mTwo=${m7}
  mF6=`echo ${m6} | cut -c3-`'.'${mTwo}

  mFour=${m8}
  mF7=`echo ${m7} | cut -c3-`'.'${mFour}

  mFour=${m9}
  mF8=`echo ${m8} | cut -c5-`'.'${mFour}

  mFour=${m10}
  mF9=`echo ${m9} | cut -c5-`'.'${mFour}

  echo ${mF1} ${mF2} ${mF3} ${mF4} ${mF5} ${mF6} ${mF7} ${mF8} ${mF9}
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sh scripting problem, matching specific white space

Hey, I'm desperately in need of a solution to a seemingly easy problem. How can I match a specific number of spaces and replace them. As in, I have a file that instead of being broken into parts by new lines is broken into parts via 500+ spaces. How can I replace any grouping of more than 400... (7 Replies)
Discussion started by: Dickalicious
7 Replies

2. Solaris

Swap sapce Adding ..??

How to add the Swap space... i know this procedure but it doesn/t work. swap -l to see the swap space (swap -s) Creak swap file mkdir 100m swap.file add the swap file swap -a swap.file... but it not work ..!! (9 Replies)
Discussion started by: udayn
9 Replies

3. Shell Programming and Scripting

remove white space from specific columns in text file

Hello i have a text file like this: 1 AB AC AD EE 2 WE TR YT WW 3 AS UY RF YT the file is bigger , but that's an example of the data what i want to do is to merge all columns together except the first one, it will become like this : 1 ABACADEE 2 WETRYTWW 3 ASUYRFYT (8 Replies)
Discussion started by: shelladdict
8 Replies

4. UNIX for Dummies Questions & Answers

Adding tags to a specific column of a space delimited text file

I have a space delimited text file with two columns. I would like to add NA to the first column of the text file. Input: 19625 10.4791768259 19700 10.8146489183 19701 10.9084026759 19702 10.9861346978 19703 10.9304364984 Output: NA19625 10.4791768259 NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

Add a character C in a column if that column is blank

I have some files that look as follows. I need to add a character 'C' in the fifth column if that column is blank. I prefer in-place editing. 1 1 B M 0 0 203 0, 0.0 0, 0.0 0, 0.0 0, 0.0 0.000 360.0 360.0 360.0 141.9 15.4 28.8 66.1 2 2 B A ... (21 Replies)
Discussion started by: thejitha
21 Replies

6. Shell Programming and Scripting

Shell command to Strip white spaces at specific location

Hello, I have a Comma separated input file with one of the sample records as below: -9223372036854477528,"834","834003325515BXNI00101012013C","5","PLAN_VALUE","PPO, General Cable","C",20130101,99991231,"A","2012-12-25-13.58.14.434000","ZPL2 ","2012-12-25-13.58.14.434000","ZPL2 ... (4 Replies)
Discussion started by: Praveenkulkarni
4 Replies

7. Shell Programming and Scripting

Insert data in first column(if blank) from previous line first column

Dear Team I need to insert field(which is need to taken from previous line's first field) in first column if its blank. I had tried using sed but not find the way. Detail input and output file as below. Kindly help for same. INPUT: SCGR SC DEV DEV1 NUMDEV DCP ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

8. Shell Programming and Scripting

Removing blank/white spaces and special characters

Hello All , 1. I am trying to do a task where I need to remove Blank spaces from my file , I am usingawk '{$1=$1}{print}' file>file1Input :- ;05/12/1990 ;31/03/2014 ; Output:- ;05/12/1990 ;31/03/2014 ;This command is not removing all spaces from... (6 Replies)
Discussion started by: himanshu sood
6 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

10. Shell Programming and Scripting

Split column when value in column is blank in any row

Hi Experts, In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data My issue is i am not able to get header for column from raw file into new file which... (1 Reply)
Discussion started by: as7951
1 Replies
pbmclean(1)						      General Commands Manual						       pbmclean(1)

NAME
pbmclean - flip isolated pixels in portable bitmap SYNOPSIS
pbmclean [-minneighbors=N] [-black|-white] [pbmfile] You can use the minimum unique abbreviation of the options. You can use two hyphens instead of one. You can separate an option name from its value with white space instead of an equals sign. Before December 2001, pbmclean accepted -N instead of -minneighbors. DESCRIPTION
pbmclean cleans up a PBM image of random specs. It reads a PBM image as input and outputs a PBM that is the same as the input except with every pixel which has less than N identical neighbours inverted. The default for N is 1 - only completely isolated pixels are flipped. (A value of N greater than 8 generates a completely inverted image (but use pnminvert to do that) -- or a completely white or completely black image with the -black or -white option). pbmclean considers the area beyond the edges of the image to be white. (This matters when you consider pixels right on the edge of the image). You can use pbmclean to clean up "snow" on bitmap images. OPTIONS
-black -white Flip pixels of the specified color. By default, if you specify neither -black nor -white, pbmclean flips both black and white pix- els which do not have sufficient identical neighbors. If you specify -black, pbmclean leaves the white pixels alone and just erases isolated black pixels. Vice versa for -white. You may specify both -black and -white to get the same as the default behavior. SEE ALSO
pbm(5) AUTHOR
Copyright (C) 1990 by Angus Duggan Copyright (C) 1989 by Jef Poskanzer. Copyright (C) 2001 by Michael Sternberg. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. This software is provided "as is" without express or implied warranty. 18 Oct 2001 pbmclean(1)
All times are GMT -4. The time now is 02:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy