Sponsored Content
Full Discussion: sed Solaris Problem
Top Forums Shell Programming and Scripting sed Solaris Problem Post 302436269 by Scrutinizer on Saturday 10th of July 2010 08:45:10 AM
Old 07-10-2010
Try:
Code:
#!/usr/xpg4/bin/sh
for file in $(find /home9/user/..../.../Test/ -type f)

do
head -n 1 $file | egrep '^#!' 
if [ $? -eq 0 ] 
    then

/usr/xpg4/bin/sed '2i\
header' "$file" > "$file.new" && mv "$file.new" "$file" 

else

/usr/xpg4/bin/sed '1i\
header' "$file" > "$file.new" && mv "$file.new" "$file"
fi


done

 

10 More Discussions You Might Find Interesting

1. Solaris

Sed problems on Solaris 10

Hi, The config file: # Port(s) for accepting client connections RTSPPort=554 bash-3.00# awk -F"=" -v gr="888" '/RTSPPort/{$2=gr;}1' OFS="=" server.ini awk: syntax error near line 1 awk: bailing out near line 1 Can you help me on why this doesn't work. The next one neighter. Dosn't... (0 Replies)
Discussion started by: potro
0 Replies

2. UNIX for Advanced & Expert Users

Sed problem

Hi, I tried the following sed -n '/one/p' file1 I need to understand, is it possible to search pattern irrespective of case. Thanks, Shahnaz. (4 Replies)
Discussion started by: shahnazurs
4 Replies

3. Shell Programming and Scripting

Sed problem

HI, I have a file test which content are as APP_NAME="%APPNAME%" Now, i m using sed command to replace the %APPNAME% with variable APPNAME. Here variable value is as export APPNAME="AB" sed -i "" -e "s:%APPNAME%:$APPNAME:" ./test test file become as APP_NAME="AB" Which is... (4 Replies)
Discussion started by: Saurabh78
4 Replies

4. Shell Programming and Scripting

using Sed in Solaris bash

I am trying to execute a script with sed that works well in ksh(Linux) however in bash(solaris 8) though it does not give any errors the output file becomes 0 byte. header of the script: ksh:2$ head news.ksh #!/bin/ksh... (2 Replies)
Discussion started by: acharania2011
2 Replies

5. Shell Programming and Scripting

Sed problem

Hi again! Sed is very difficult to understand for me... :( I have a file like this And I'm looking for this result I found sed '$!N;s/\n/ /' => Put Line1 and Line2 together, Line3 and Line4... I tried |sed '$!N;s/\n*\n/ /' but it didn't work... Thanks for your help PS:And... (6 Replies)
Discussion started by: Castelior
6 Replies

6. Shell Programming and Scripting

SED Problem

Hi all, I want to replace the first two occurances of "Gautam" with "Gomzy" using the sed command. if i do this: sed 's/gautam/gomzy/g' <filename> Then it replaces all the occurances of gautam with gomzy. But i only want to replace the first two occurances. i tried out with this: sed... (2 Replies)
Discussion started by: gautamshaw
2 Replies

7. Shell Programming and Scripting

sed problem

I am trying to use sed to make some changes to some HTML-like code. The code looks like this: <aaa bbb="xxxx" params="@abc@ @defghi@ @j@"></aaa> <aaa params="@abc@ @defghi@">value</aaa><aaa params="@klm@ @nopq@ @rstu@"></aaa> <aaa params="@v@ @wxy@ @z@"></aaa>There is an aaa tag which can... (4 Replies)
Discussion started by: RickS
4 Replies

8. Shell Programming and Scripting

solaris sed equivalent

Hi Experts, I am using this command to edit the file contents and also add the header to the existing file. I prepared this command on my VM (Linux) and it worked as I wanted it to work. But on solaris its not working :(. Please help as it is quite urgent. sample File: a b Output... (5 Replies)
Discussion started by: sugarcane
5 Replies

9. Shell Programming and Scripting

[SOLVED] sed -i not available in solaris 5.10

Hi All, i'm writing a script where i have to grep for a pattern and the 3 lines after the pattern and comment them out. Note that i have to do this for multiple files, i am able to grep the pattern and the next 3 lines but since solaris does not recognize the -i option, i was wondering if... (11 Replies)
Discussion started by: Irishboy24
11 Replies

10. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
largefile(5)                                            Standards, Environments, and Macros                                           largefile(5)

NAME
largefile - large file status of utilities DESCRIPTION
A large file is a regular file whose size is greater than or equal to 2 Gbyte ( 2**31 bytes). A small file is a regular file whose size is less than 2 Gbyte. Large file aware utilities A utility is called large file aware if it can process large files in the same manner as it does small files. A utility that is large file aware is able to handle large files as input and generate as output large files that are being processed. The exception is where additional files are used as system configuration files or support files that can augment the processing. For example, the file utility supports the -m option for an alternative "magic" file and the -f option for a support file that can contain a list of file names. It is unspecified whether a utility that is large file aware will accept configuration or support files that are large files. If a large file aware utility does not accept configuration or support files that are large files, it will cause no data loss or corruption upon encountering such files and will return an appropriate error. The following /usr/bin utilities are large file aware: adb awk bdiff cat chgrp chmod chown cksum cmp compress cp csh csplit cut dd dircmp du egrep fgrep file find ftp getconf grep gzip head join jsh ksh ln ls mdb mkdir mkfifo more mv nawk page paste pathchck pg rcp remsh rksh rm rmdir rsh sed sh sort split sum tail tar tee test touch tr uncompress uudecode uuencode wc zcat The following /usr/xpg4/bin utilities are large file aware: awk cp chgrp chown du egrep fgrep file grep ln ls more mv rm sed sh sort tail tr The following /usr/xpg6/bin utilities are large file aware: getconf ls tr The following /usr/sbin utilities are large file aware: install mkfile mknod mvdir swap See the USAGE section of the swap(1M) manual page for limitations of swap on block devices greater than 2 Gbyte on a 32-bit operating sys- tem. The following /usr/ucb utilities are large file aware: chown from ln ls sed sum touch The /usr/bin/cpio and /usr/bin/pax utilities are large file aware, but cannot archive a file whose size exceeds 8 Gbyte - 1 byte. The /usr/bin/truss utilities has been modified to read a dump file and display information relevant to large files, such as offsets. cachefs file systems The following /usr/bin utilities are large file aware for cachefs file systems: cachefspack cachefsstat The following /usr/sbin utilities are large file aware for cachefs file systems: cachefslog cachefswssize cfsadmin fsck mount umount nfs file systems The following utilities are large file aware for nfs file systems: /usr/lib/autofs/automountd /usr/sbin/mount /usr/lib/nfs/rquotad ufs file systems The following /usr/bin utility is large file aware for ufs file systems: df The following /usr/lib/nfs utility is large file aware for ufs file systems: rquotad The following /usr/xpg4/bin utility is large file aware for ufs file systems: df The following /usr/sbin utilities are large file aware for ufs file systems: clri dcopy edquota ff fsck fsdb fsirand fstyp labelit lockfs mkfs mount ncheck newfs quot quota quotacheck quotaoff quotaon repquota tunefs ufsdump ufsrestore umount Large file safe utilities A utility is called large file safe if it causes no data loss or corruption when it encounters a large file. A utility that is large file safe is unable to process properly a large file, but returns an appropriate error. The following /usr/bin utilities are large file safe: audioconvert audioplay audiorecord comm diff diff3 diffmk ed lp mail mailcompat mailstats mailx pack pcat red rmail sdiff unpack vi view The following /usr/xpg4/bin utilities are large file safe: ed vi view The following /usr/xpg6/bin utility is large file safe: ed The following /usr/sbin utilities are large file safe: lpfilter lpforms The following /usr/ucb utilities are large file safe: Mail lpr The following /usr/lib utility is large file safe: sendmail SEE ALSO
lf64(5), lfcompile(5), lfcompile64(5) SunOS 5.10 7 Nov 2003 largefile(5)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy