Sponsored Content
Top Forums Shell Programming and Scripting sed garbled error message in bash shell Post 302736669 by smenago on Tuesday 27th of November 2012 05:01:31 PM
Old 11-27-2012
I removed the trailing space and checked to make sure there were not others with a :set list, but the same message returned.

Code:
outfile='DAR.V2.2012115.1.CSV'$
$
testfile='totality_request.sql'$
$
header_prefix='DATA FILE'$
$
no_ext_file=`echo $outfile |sed 's/\(.*\)..../\1/'`$
$
echo $no_ext_file$
$
header_file="$header_prefix $no_ext_file"$
$
echo $header_file$
$
trailer_prefix='DATA RECORDS'$
$
trailer_records=`wc -l $outfile| awk '{print $1}'`$
$
echo $trailer_records$
$
trailer_file="$trailer_prefix $trailer_records"$
$
echo $trailer_file$
$
sed "1i\$
$header_file $outfile" > outfile_new$

It seems that it wants to treat the 1i as text and not part of the command?

Code:
smenago@eqewrslhp01$ bash -x test3.sh
+ outfile=DAR.V2.2012115.1.CSV
+ testfile=totality_request.sql
+ header_prefix='DATA FILE'
++ echo DAR.V2.2012115.1.CSV
++ sed 's/\(.*\)..../\1/'
+ no_ext_file=DAR.V2.2012115.1
+ echo DAR.V2.2012115.1
DAR.V2.2012115.1
+ header_file='DATA FILE DAR.V2.2012115.1'
+ echo DATA FILE DAR.V2.2012115.1
DATA FILE DAR.V2.2012115.1
+ trailer_prefix='DATA RECORDS'
++ wc -l DAR.V2.2012115.1.CSV
++ awk '{print $1}'
+ trailer_records=2
+ echo 2
2
+ trailer_file='DATA RECORDS 2'
+ echo DATA RECORDS 2
DATA RECORDS 2
+ sed '1iDATA FILE DAR.V2.2012115.1 DAR.V2.2012115.1.CSV'
+ sed 'DATA RECORDS 2'
sed: command garbled: 1iDATA FILE DAR.V2.2012115.1 DAR.V2.2012115.1.CSV
sed: command garbled: DATA RECORDS 2


Last edited by smenago; 11-27-2012 at 06:10 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Garbled Sed w/variables

I'm trying to get a partial file path by passing the part I want removed to sed. Sed gets garbled when I try multiple directories (i.e. because of the extra slash). For example: FULLFILEPATH="usr/local/bin" STRIPDIR="usr" PARTFILEPATH=`echo $FULLFILEPATH | sed s/\${STRIPDIR}//` Gives me... (3 Replies)
Discussion started by: bergerj3
3 Replies

2. Shell Programming and Scripting

sed: command garbled

Im getting this error message when trying to substitute filepaths in a sed search and replace string #!/usr/bin/ksh ORACLE_SID=PH3 ORACLE_ADMIN=/data01/app/oracle/admin/$ORACLE_SID DATAFILE_DIR=/asterisk/oradata/$ORACLE_SID sed -e s/DBNAME/$ORACLE_SID/g < initPH2.ora | sed -e... (1 Reply)
Discussion started by: blakmk
1 Replies

3. Shell Programming and Scripting

sed: command garbled error.....

Dear friends, please give me the solution to the following query. If a file contains multiple tags of same name, then how to get the required string between the tags, in which the string begins with "W/X" i.e., file1.txt contains following text(please note that all the following tags are in... (1 Reply)
Discussion started by: swamymns
1 Replies

4. Shell Programming and Scripting

Sed: command garbled :s/

Hi, I really need some help, I am using a very basic script to proess a text file. This script has been used many times but all of a sudden all on it's own it's stopped working. The line in the script is: sed 's/ //g' $ORGFILE > $NEWFILE and the error is Sed: command garbled :s/ All... (3 Replies)
Discussion started by: heidi.lightfoot
3 Replies

5. Shell Programming and Scripting

sed: command garbled

Hi, I have a file1 as : A=/home/user B=/home/user1 C=/home/user2 D=/home/aacsms E=/home/user1/temp F=/home/user1/area1 and my script as: a=`cat /home/aacsms7/file1 | grep -i e` b=`user2` sed 's/'$a'/"E=/home/'$b'/temp"/g' < file1 > file2 sed: command garbled:... (3 Replies)
Discussion started by: yesmani
3 Replies

6. Shell Programming and Scripting

sed command garbled error

sed: command garbled: s/ri="*"/ri=" what i did is you can see below sed "s/ri=\"*\"/ri=\"$newri\"/" $2 > output how to solve this (2 Replies)
Discussion started by: pasricha.kunal
2 Replies

7. Shell Programming and Scripting

Sed command garbled question

for j in $(cat ${list_B}) do to_replace_2=$(grep $j ${useralias}_2) sed "s/^${j}/${to_replace_2}/p" ${entries} > ${entries}_2 mv ${entries}_2 ${entries} done Hi, I've the above sed command running in a script. Its basically looping through a file and replacing its beginning of line... (8 Replies)
Discussion started by: Jazmania
8 Replies

8. Shell Programming and Scripting

sed: command garbled error

Hi all, Suppose that I want to update the db.password entry in the below properties file, db.username=admin db.password=qhKkBno2U5GEq5k/dnmGPA== //I want this line to be replaced by: "db.password=abc/123/" db.host=server db.port=22 db.sid=database However when... (2 Replies)
Discussion started by: isaacniu
2 Replies

9. Shell Programming and Scripting

sed help - Command garbled

Hi, First post for a noob so please go easy with me :) I have a XML block that is originally like this: <SETNAME>somecrap/THIS</SETNAME> and I would like it be replaced with, in the original file: <SETNAME>THIS</SETNAME> I tried to use: sed... (4 Replies)
Discussion started by: zhuanyi
4 Replies

10. Shell Programming and Scripting

Command garbled when using sed

Hi everyone, Can anyone help me in question below? I want to cron a job to add partition every month but get the error sed: command garbled: s/YYYYMM/ . > echo $YYYYMON_NEW 201304 > echo $YYYYMON_OLD 201208 > echo $YYYY_MM_NEW 2013-05 This is my base script: ALTER TABLE STS.ADMIN ADD... (1 Reply)
Discussion started by: fenocean
1 Replies
lav2yuv(1)							MJPEG tools manual							lav2yuv(1)

NAME
lav2yuv - Convert a MJPEG file to raw yuv SYNOPSIS
lav2yuv [options] lavfile1 [lavfile2 ... lavfileN] DESCRIPTION
lav2yuv converts an MJPEG video sequence described by a sequence of MJPEG video files and/or edit lists pointing to such files into the simple uncompressed planar 4:2:0 Y'CbCr format, as used by mpeg2enc(1) MPEG encoder and image processing filters like yuvscaler(1) or yuv2dfilter(1) or yuvdenoise(1). Output is to stdout so that by piping the output of lav2yuv into a suitable pipeline it is possible to process and then encode or play back video recorded in any of the mjpegtools MJPEG container formats: AVI, quicktime or edit lists describing editted versions of video held in such files. Mixing different files with different video formats is currently not possible. The -S -T -D options are used for scene detection which is used by linux video studio. OPTIONS
lav2yuv accepts the following options: -m Force mono-chrome -c Conceal frames containing corrupt MJPEG data by repeating the preceeding good frame. -S list.el Output a scene list with scene detection -T num Set scene detection threshold to num (default: 4) -D num Width decimation to use for scene detection (default: 2) -o num Frame offset - skip num frames at the beginning. if num is negative all but the last num frames are skipped -f num Only num frames are written to stdout. 0 means that all frames are processed. -A width:height Set/override the sample aspect ratio (SAR) emitted in the output stream header. Currently, the SAR is only auto-detected for DV files, and guessed otherwise. -P width:height Set the intended/approximate display aspect ratio (DAR) for the stream. This value is only used to guess the SAR when it cannot be detected from the input stream. The default DAR is '4:3' (corresponding to a standard TV screen); another useful value is '16:9' (corresponding to widescreen TV). -C chroma Set output chroma (default: '420jpeg'). Currently, '420jpeg', '420mpeg2', '420paldv', '422' are available. -x Exchange fields. Useful if the field order was reversed during editing. AUTHOR
This man page was originally written by Bernhard Praschinger. If you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is: mjpeg-users@lists.sourceforge.net For more info, see our website at http://mjpeg.sourceforge.net SEE ALSO
mjpegtools(1), mpeg2enc(1), yuvscaler(1), yuv2lav(1), yuvdenoise(1), yuvplay(1) MJPEG Linux Square 6 March 2002 lav2yuv(1)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy