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
MIDI2MG(1)						      General Commands Manual							MIDI2MG(1)

NAME
midi2mg - convert a midi file into midge(1) text format. SYNOPSIS
midi2mg [ options ] midi_file DESCRIPTION
midi2mg reads a midi file and writes its contents to a file in midge(1) text format. It prints a message to stdout for any midi events it can't handle. OPTIONS
-h or --help Display help text. -v or --verbose Print verbose messages to stdout. -q or --quiet Quiet. No stdout. -o file or --outfile file Write output to file. Otherwise converts file.mid to file.mg Outputs to stdout if file is `-'. When outputting to stdout quiet mode is automatically set unless verbose mode is set earlier on the command line. -w or --ignore-wrong-track Ignore MIDI events on the wrong channel instead of exiting. -n i[,j...] or --include-tracks i[,j...] Only convert the tracks in the comma separated list, with track numbers starting from 1. -N i[,j...] or --exclude-tracks i[,j...] Convert all tracks except those specified in the comma separated list. -t n or --tuplet-factor n An additional factor for files with odd note lengths, to prevent them being translated as decimals (n should be a prime number greater than 3). -F or --no-factorise Do not factorise time values (may help to decipher unusual tuplet values). BUGS
Does not correctly handle some text events. Does not handle SMTPE style tempo events. Does not handle changes of tempo/time_sig/key if these are on a separate tempo track. SEE ALSO
midge(1) AUTHOR
David Riley <dave@dmriley.demon.co.uk> 17 July 2006 MIDI2MG(1)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy