Sponsored Content
Top Forums Shell Programming and Scripting AWK adding prefix/suffix to list of strings Post 302625693 by chrisjorg on Wednesday 18th of April 2012 06:27:22 AM
Old 04-18-2012
I would like to do these three printing commands at once, why am I getting an error?

Code:
awk '{print 'scp -r pdb_00.namd pdb_"$0".namd'; print 'sed 's/'pdb_00'/'pdb_"$0"'/g' pdb_"$0".namd > tempo'; print 'mv tempo pdb_"$0".namd'}' datA.dat > copy_script.bash

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

prefix suffix to each argument

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

2. Shell Programming and Scripting

Awk search for a element in the list of strings

Hi, how do I match a particular element in a list and replace it with blank? awk 'sub///' $FILE list="AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,... (2 Replies)
Discussion started by: grossgermany
2 Replies

3. Shell Programming and Scripting

Adding new lines to a file + adding suffix to a pattern

I need some help with adding lines to file and substitute a pattern. Ok I have a file: #cat names.txt name: John Doe stationed: 1 name: Michael Sweets stationed: 41 . . . And would like to change it to: name: John Doe employed permanently stationed: 1-office (7 Replies)
Discussion started by: hemo21
7 Replies

4. Shell Programming and Scripting

Adding prefix to the values in the script

Hi, test.txt contains below values 1 2 3 4 5 Desired output: 'TT.1', 'TT.2', 'TT.3', 'TT.4', 'TT.5' Last value should not contain the comma after the value. Below is the script which i have tried. I'm using Linux. #!/bin/bash for i in $test.txt (4 Replies)
Discussion started by: venkatesht
4 Replies

5. Linux

Adding a prefix to a column using awk/sed commands

Hello, I am a newbie to linux and struggling to find a better way to append a column in a text file. Here is the file i want to modify: It has 8 columns (and thousands of rows). I want to append the first column by adding "chr" infront of the numbers. Some rows have a string in the first... (4 Replies)
Discussion started by: bjorngill
4 Replies

6. Shell Programming and Scripting

Replace prefix and suffix of a string

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

7. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

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

Common prefix of a list of strings

Is there a simple way to find the longest common prefix of a space-separated list of strings, optionally by field? For example, given input: "aaa_b_cc aaa_b_cc_ddd aaa_b_cc aaa_b_cd"with no field separator, output: aaa_b_cwith _ field separator, output: aaa_bI have an awk solution which... (1 Reply)
Discussion started by: CarloM
1 Replies

9. Shell Programming and Scripting

Suffix formatting with awk

i would like to format the 9 character with suffix as "0". i tried below it doesn't work. >a=12345 > echo $a | awk '{printf "%-09s\n",$1}' >12345 required output is 123450000 can you guys help me out ? (7 Replies)
Discussion started by: expert
7 Replies

10. UNIX for Advanced & Expert Users

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 (3 Replies)
Discussion started by: Nayaj
3 Replies
MIDIPLAY(1)						    BSD General Commands Manual 					       MIDIPLAY(1)

NAME
midiplay -- play MIDI and RMID files SYNOPSIS
midiplay [-d devno] [-f file] [-l] [-m] [-p pgm] [-q] [-t tempo] [-v] [-x] [file ...] DESCRIPTION
The midiplay command plays MIDI and RMID files using the sequencer device. If no file name is given it will play from standard input, other- wise it will play the named files. RMID files are Standard MIDI Files embedded in a RIFF container and can usually be found with the 'rmi' extension. They contain some addi- tional information in other chunks which are not parsed by midiplay yet. The program accepts the following options: -d devno specifies the number of the MIDI device used for output (as listed by the -l flag). There is no way at present to have midiplay map playback to more than one device. The default is device is given by environment variable MIDIUNIT. -f file specifies the name of the sequencer device. -l list the possible devices without playing anything. -m show MIDI file meta events (copyright, lyrics, etc). -p pgm force all channels to play with the single specified program (or instrument patch, range 1-128). Program change events in the file will be suppressed. There is no way at present to have midiplay selectively map channels or instruments. -q specifies that the MIDI file should not be played, just parsed. -t tempo-adjust specifies an adjustment (in percent) to the tempi recorded in the file. The default of 100 plays as specified in the file, 50 halves every tempo, and so on. -v be verbose. If the flag is repeated the verbosity increases. -x play a small sample sound instead of a file. A file containing no tempo indication will be played as if it specified 150 beats per minute. You have been warned. ENVIRONMENT
MIDIUNIT the default number of the MIDI device used for output. The default is 0. FILES
/dev/music MIDI sequencer device SEE ALSO
midi(4) HISTORY
The midiplay command first appeared in NetBSD 1.4. BUGS
It may take a long while before playing stops when midiplay is interrupted, as the data already buffered in the sequencer will contain timing events. BSD
January 16, 2010 BSD
All times are GMT -4. The time now is 12:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy