05-04-2015
Prefix/Suffix on same file
Hi,
I want to add prefix and suffix on line# 205 using SED or AWK and want to change on the same file without creating new file.
This command will be used in the bash script
Am using Bash shell
Regards
Nayaj
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
How would i check a file exists with certainprefix? i have a directory with some files:
ABC1
ABC2
ABC3
etc..
and want to do:
please note i am using the korn shell environment.As when i gone through some stuff on then net i came to know some of the options will work... (11 Replies)
Discussion started by: raoscb
11 Replies
2. Shell Programming and Scripting
Hi,
I have a variable, which contains comma separated values. Something like.
StringA="abc,def,ghi,jkl"
I want to apply prefix and suffix to each value in the string without using any loops.
Say if Prefix is Pre_ and Suffix is _Suf then I need to get
... (1 Reply)
Discussion started by: tostay2003
1 Replies
3. Shell Programming and Scripting
Hi all,
i have a shell script invoking a pl/sql proc which then, generates a file in a format
DATA-26-12-2009.txt. The shell script is configured as a cron job to run once a day.
If i need to run the script more than once, i need to suffix the generated file with a two digit running... (4 Replies)
Discussion started by: krishna.saran
4 Replies
4. Shell Programming and Scripting
Hi,
I'm using a .ksh script to split one file into multible files by checking for the prefix per line. It works perfekt (thanks again for anyone involved in helping me with that ;)), but I want to remove the prefix per line too. Means only the line information itself should remain in the... (7 Replies)
Discussion started by: spidermike
7 Replies
5. Shell Programming and Scripting
Hi, I'm new about shell scripting, and I need to do something like
abcd **1234** efgh
by
abcd '''1234''' efgh
I know that command sed helps about change one string by another, but I dont know how to keep whatever is inside **_** and replace * with '.
Thanks! (5 Replies)
Discussion started by: selvaya
5 Replies
6. UNIX for Dummies Questions & Answers
I have a directory full of personal files named similar to the following:
043 fflshju
923- osfjpojfsa
1 - oasfns.txt:wall:
What I would like to do is strip any leading numbers, spaces, dashes (etc.)..
and leave only the main section of the name.
For example, the preceeding list would be... (1 Reply)
Discussion started by: lazerking9
1 Replies
7. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
8. Shell Programming and Scripting
75
103
131
133
138
183
197
221
232
234
248
256
286
342
368
389
463
499
524
538 (5 Replies)
Discussion started by: chrisjorg
5 Replies
9. Shell Programming and Scripting
Hi,
Below script used for sftp get,
#/bin/bash
USER=xxx
PASS=xxx
HOST=xxx
REMOTE_FILE=$1
LOCAL_FILE_LOC=$2
cd $LOCAL_FILE_LOC
lftp sftp://$USER:$PASS@$HOST:10022 -e "get $REMOTE_FILE; bye"
If file does not exist in sftp server, and file (same as remote file name) exists in local dir,... (4 Replies)
Discussion started by: vhegde1011
4 Replies
10. Shell Programming and Scripting
Dear All,
assume i have a file with content:
<Start>6000</Start>
<Stop>7599</Stop>
the output is:
6000
7000
7100
7200
7300
7400
7599
how should we use any awk, sed, perl can do this task, means to extract the uniq prefixes from the start and stop prefix.
Thanks
Jimmy (3 Replies)
Discussion started by: jimmy_y
3 Replies