Sponsored Content
Full Discussion: SED inside while loop
Top Forums UNIX for Dummies Questions & Answers SED inside while loop Post 302370592 by paku on Thursday 12th of November 2009 01:21:21 AM
Old 11-12-2009
Hi,
I am not sure how your input file is.
Assuming your input file test.csv as
a,b,c,d,e,,f
a,b,c,d,e,,f
a,b,c,d,e,,f
a,b,c,d,e,,f

the following code will give you the desired output.
cnt=1
while read line; do
sed -n ''$cnt' p' test.csv | sed 's/\,\,/\,one'$cnt'too'$cnt'\,/' >> test1.csv
cnt=$(echo "$cnt + 1" | bc)
done < test.csv

output:
a,b,c,d,e,one1too1,f
a,b,c,d,e,one2too2,f
a,b,c,d,e,one3too3,f
a,b,c,d,e,one4too4,f

Hope this helps.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

remsh inside of while loop

I have a space delimited file containing: hostname OracleSID connectstring I want to loop through the file and execute remsh to check the database processes. cat $filename | while read HOST SID CONNECT do { result=`remsh $HOST "ps -ef | grep pmon_${SID}$| grep -v grep"` if ........ (1 Reply)
Discussion started by: joettacm
1 Replies

2. Shell Programming and Scripting

variable inside variable inside loop headache

Hi Gurus I have a file called /tmp/CMDB which looks like this serial: 0623AN1208 hostname: server1 model: x4100 assetID: 1234 I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

3. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

4. Shell Programming and Scripting

Using 'su' inside a loop

Hi, I am using su within a for loop. As you might expect, it prompts for password during each loop execution. Here is my piece of code: for i in $LIST do if then DATABASE=`echo $i | awk -F "|" '{ print $1 }'` USER_ID=`echo $i | awk -F "|" '{ print $2 }'` su - apstage -c... (1 Reply)
Discussion started by: sugan
1 Replies

5. Shell Programming and Scripting

Need help using sed inside the loop.

Hi, i have written a script. it collects data based on the sql queries executed by it. i have multiple output files. after the output file is made i need to do some cosmetic changes in the files and then store them. i am unable to use sed conditions inside the loop. see below code for... (3 Replies)
Discussion started by: dazdseg
3 Replies

6. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

7. Shell Programming and Scripting

sed inside sed for replacing string

My need is : Want to change docBase="/something/something/something" to docBase="/only/this/path/for/all/files" I have some (about 250 files)xml files. In FileOne it contains <Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Discussion started by: linuxadmin
1 Replies

8. Shell Programming and Scripting

help using EOF inside a for loop

I'm having problems with this example: #!/bin/bash for i in server1 server2 server3 do ssh $i <<EOF >> logfile.txt dat1=`date '+%m/%d/%y'` hst=`hostname` df -Ph | awk -v OFS=',' -v dat="$dat1,$hst" ' {print dat,$1,$6,$3,$4 } ' exit EOF done I'm... (1 Reply)
Discussion started by: kuliksco
1 Replies

9. Shell Programming and Scripting

If inside If loop

Hi All, Below is the very simple code snippet but it si giving me syntax error #!/bin/bash #To ensure If JMS directory exists or not ServerName=$(hostname) #To ensure If JMS directory exists or not echo $ServerName if ; then echo "Inside First If" if ; then echo 'JMS... (4 Replies)
Discussion started by: sharsour
4 Replies

10. UNIX for Dummies Questions & Answers

Write a while loop inside for loop?

I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off.... I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Discussion started by: xxhieixx
3 Replies
hipercdecode(1) 					      General Commands Manual						   hipercdecode(1)

NAME
hipercdecode - Decode a HIPERC stream into human readable form. SYNOPSIS
hipercdecode [options] <hiperc-file DESCRIPTION
hipercdecode decodes a HIPERC stream into human readable form. Uncompressed and JBIG formats are handled. An HIPERC stream is the printer langauge used by the Oki Data C310dn, C3100, C3200n, C3250n, C3300n, C3400n, C5100n, C5250n, C5500n, C5600, and the C5800n printers. COMMAND LINE OPTIONS
These are the options that can appear on the command line. -d basename Basename of .pbm file for saving decompressed planes. -h Print hex file offsets. -o Print file offsets. -D level Set Debug level [0]. EXAMPLES
Decode an HIPERC stream file created by foo2hiperc. $ foo2hiperc-wrapper testpage.ps | hipercdecode -h 0: 33%-12345X@PJL f: @PJL RDYMSG DISPLAY = "Unknown" 30: @PJL SET OKIJOBACCOUNTJOB USERID="Unknown" JOBNAME="Unknown" 6e: @PJL SET OKIAUXJOBINFO DATA="DocumentName=Unknown" a2: @PJL SET OKIAUXJOBINFO DATA="ComputerName=dual.rkkda.org" dd: @PJL SET OKIAUXJOBINFO DATA="ReceptionTime=00:00:00 2008/01/30" 11e: @PJL SET OKIAUTOTRAYSWITCH=ON 13d: @PJL SET OKIPAPERSIZECHECK=ENABLE 160: @PJL SET RESOLUTION=600 179: @PJL SET PAPER=LETTER 190: @PJL SET OKITRAYSEQUENCE=PAPERFEEDTRAY 1b8: @PJL SET OKIPAPERFEED=TRAY1 1d5: @PJL SET OKIMEDIATYPE = PLAIN 1f4: @PJL SET LPARM:PCL OKIPRINTMARGIN=INCH1D6 21f: @PJL SET COPIES=1 232: @PJL SET QTY=1 242: @PJL SET HIPERCEFFECTIVEBLOCKSIZE=34799360 26e: @PJL ENTER LANGUAGE=HIPERC 289: RECTYPE 0 (len=52,0x34 cnt=1) 291: BLKNUM 0, nbie=1, pn=3 [black] uc=0,0, wid=4864 ud=0,100 2a5: BLKNUM 1 (len=20), uncompressed=1, bie: DL = 48, D = 48, P = 49, - = 48, XY = 4864 x 6816 L0 = 256, MX = 0, MY = 0 Order = 0 Options = 0 1 stripes, 0 layers, 49 planes 2bd: RECTYPE 1 (len=155668,0x26014 cnt=1) 2c5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2cd: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 262d1: RECTYPE 1 (len=155668,0x26014 cnt=2) 262d9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 262e1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 4c2e5: RECTYPE 1 (len=155668,0x26014 cnt=3) 4c2ed: BLKNUM 0 (len=4), plane=3, uc=0,0,0 4c2f5: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 722f9: RECTYPE 1 (len=155668,0x26014 cnt=4) 72301: BLKNUM 0 (len=4), plane=3, uc=0,0,0 72309: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 9830d: RECTYPE 1 (len=155668,0x26014 cnt=5) 98315: BLKNUM 0 (len=4), plane=3, uc=0,0,0 9831d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... be321: RECTYPE 1 (len=155668,0x26014 cnt=6) be329: BLKNUM 0 (len=4), plane=3, uc=0,0,0 be331: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... e4335: RECTYPE 1 (len=155668,0x26014 cnt=7) e433d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 e4345: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 10a349: RECTYPE 1 (len=155668,0x26014 cnt=8) 10a351: BLKNUM 0 (len=4), plane=3, uc=0,0,0 10a359: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 13035d: RECTYPE 1 (len=155668,0x26014 cnt=9) 130365: BLKNUM 0 (len=4), plane=3, uc=0,0,0 13036d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 156371: RECTYPE 1 (len=155668,0x26014 cnt=10) 156379: BLKNUM 0 (len=4), plane=3, uc=0,0,0 156381: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 17c385: RECTYPE 1 (len=155668,0x26014 cnt=11) 17c38d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 17c395: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1a2399: RECTYPE 1 (len=155668,0x26014 cnt=12) 1a23a1: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1a23a9: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1c83ad: RECTYPE 1 (len=155668,0x26014 cnt=13) 1c83b5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1c83bd: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 1ee3c1: RECTYPE 1 (len=155668,0x26014 cnt=14) 1ee3c9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 1ee3d1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2143d5: RECTYPE 1 (len=155668,0x26014 cnt=15) 2143dd: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2143e5: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 23a3e9: RECTYPE 1 (len=155668,0x26014 cnt=16) 23a3f1: BLKNUM 0 (len=4), plane=3, uc=0,0,0 23a3f9: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2603fd: RECTYPE 1 (len=155668,0x26014 cnt=17) 260405: BLKNUM 0 (len=4), plane=3, uc=0,0,0 26040d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 286411: RECTYPE 1 (len=155668,0x26014 cnt=18) 286419: BLKNUM 0 (len=4), plane=3, uc=0,0,0 286421: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2ac425: RECTYPE 1 (len=155668,0x26014 cnt=19) 2ac42d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2ac435: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2d2439: RECTYPE 1 (len=155668,0x26014 cnt=20) 2d2441: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2d2449: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 2f844d: RECTYPE 1 (len=155668,0x26014 cnt=21) 2f8455: BLKNUM 0 (len=4), plane=3, uc=0,0,0 2f845d: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 31e461: RECTYPE 1 (len=155668,0x26014 cnt=22) 31e469: BLKNUM 0 (len=4), plane=3, uc=0,0,0 31e471: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 344475: RECTYPE 1 (len=155668,0x26014 cnt=23) 34447d: BLKNUM 0 (len=4), plane=3, uc=0,0,0 344485: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 36a489: RECTYPE 1 (len=155668,0x26014 cnt=24) 36a491: BLKNUM 0 (len=4), plane=3, uc=0,0,0 36a499: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 39049d: RECTYPE 1 (len=155668,0x26014 cnt=25) 3904a5: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3904ad: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3b64b1: RECTYPE 1 (len=155668,0x26014 cnt=26) 3b64b9: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3b64c1: BLKNUM 1 (len=155648), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3dc4c5: RECTYPE 1 (len=97300,0x17c14 cnt=27) 3dc4cd: BLKNUM 0 (len=4), plane=3, uc=0,0,0 3dc4d5: BLKNUM 1 (len=97280), Data=00 00 00 00 00 00 00 00 00 00 00 ... 3f40d9: RECTYPE 255 (len=8,0x8 cnt=28) 3f40e1: 33%-12345X FILES
/usr/bin/hipercdecode SEE ALSO
foo2hiperc-wrapper(1), foo2hiperc(1) AUTHOR
Rick Richardson <rick.richardson@comcast.net> http://foo2hiperc.rkkda.com/
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy