Sponsored Content
Full Discussion: String concatenation
Top Forums Shell Programming and Scripting String concatenation Post 302714901 by nareshkumar522 on Saturday 13th of October 2012 05:02:51 AM
Old 10-13-2012
No Its not homework.I have the single file where I splitted into two files.For simplification I have given the above one.


Code:
cat tmp.txt
/sad/a
/sda/b
/sda/c
/sda/d
/sdb/l
/sdb/j
/sdb/k
/sdb/m

I need the output as below as single file.

/sad/a:/sdb/l
/sda/b:/sdb/j
/sda/c:/sdb/k
/sda/d:/sdb/m
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string concatenation

my input file contains thousands of lines like below 234A dept of education 9788 dept of commerce 8677 dept of engineering How do i add a delimeter ':' after FIRST 4 CHARACTERS in a line 234A:dept of education 9788:dept of commerce 8677:dept of engineering (7 Replies)
Discussion started by: systemsb
7 Replies

2. Shell Programming and Scripting

Help concatenation string and variable

Hello, in my script i have this lines of code in a while cycle: .. let j=i+1 t_prod_$i = `cat myfile.csv | grep world | cut -d ";" -f$j` let i+=1 ... So if i try an echo $t_prod_$i at the end of the cycle i cannot see the right value obtained by `cat myfile.csv | grep world |... (5 Replies)
Discussion started by: drain
5 Replies

3. Shell Programming and Scripting

String concatenation with spaces

Hi, I have a variable $ID=40 and I need to build a string like 40 40 40 40 40 40 so repeating ID 'n' times separated by spaces. Any help? Thanks Sarah (2 Replies)
Discussion started by: f_o_555
2 Replies

4. Shell Programming and Scripting

String Concatenation

Hi All, I need to concatenate the values in the array into a variable. Currently the code is : for (( i=1 ; i <= $minCount ; i++ )) do var="${var}""${sample_file}" done The output is : /tmp/1/tmp/2/tmp/3/tmp/4/tmp/5/tmp/6/tmp/7/tmp/8/tmp/9/tmp/10 I need a space between... (1 Reply)
Discussion started by: sh_kk
1 Replies

5. Shell Programming and Scripting

String/Variable Concatenation

Hello, Trying to concatenate the following using bourne shell: # !/bin/bash # this works in bash shell e.g. get the results I am expecting fnTmp=C$cindex.$station_0.$station_1.$station_3.$ts.tmp # # under !/bin/sh # the results are not the same Any assistance would be... (8 Replies)
Discussion started by: LAVco
8 Replies

6. Shell Programming and Scripting

String concatenation problems

#! /bin/csh set tt=12345_UMR_BH452_3_2.txt set rr=`echo $tt | cut -d_ -f1` set rr1=welcome set ff=$rr $rr1 echo $ff why $ff returned only 12345 and not 12345welcome? thanks (2 Replies)
Discussion started by: jdsignature88
2 Replies

7. Shell Programming and Scripting

String / Variable Concatenation

Hi all, I'm trying to build a variable name automatically through a for loop for a script I'm working on, basically I want to build the variables named: $JVM_HOME0 or $JVM_HOME1 so that I can loop through some file copy/deletes and a server restart once completed. With the code below, I get this... (3 Replies)
Discussion started by: hydroponx
3 Replies

8. Shell Programming and Scripting

String concatenation problem

Hi there, I'm writing a basic script where I want to make a string of 2 numeric fields from a file, which I have done, but the behavior is rather confusing. I have a file of random values such as: 1 2 3 4 5 6 7 8 9 10 and my awk code is: BEGIN { FS = " " } { str = str $1 $2 } END {... (7 Replies)
Discussion started by: HMChadwick
7 Replies

9. Shell Programming and Scripting

Group by and string concatenation

Hi, I was trying to work on a file which had the following data format 1 hi 1 this 1 is 1 john 2 hello 3 test 3 case the expected output file is the below 1 hi, this, is, john 2 hello 3 test, case I tried using awk or while read, but I couldnt... (13 Replies)
Discussion started by: karthikbhuvana
13 Replies

10. Shell Programming and Scripting

Help with String concatenation

I have a script which is migrated from AIX to Linux & now while running it is no able to concatenate string values The string concatenation step under while loop is not displaying desired result Please find below the piece of code: while read EXT_FILE ; do EXT_FILE=$EXT_FILE.ext.sent echo... (7 Replies)
Discussion started by: PreetArul
7 Replies
WIPEFS(8)                                                      System Administration                                                     WIPEFS(8)

NAME
wipefs - wipe a signature from a device SYNOPSIS
wipefs [options] device... wipefs [--backup] -o offset device... wipefs [--backup] -a device... DESCRIPTION
wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid. wipefs does not erase the filesystem itself nor any other data from the device. When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures. The default output is sub- ject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list in environments where a stable output is required. wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature to inform the kernel about the change. Note that some filesystems and some partition tables store more magic strings on the device (e.g. FAT, ZFS, GPT). The wipefs command (since v2.31) lists all the offset where a magic strings have been detected. When option -a is used, all magic strings that are visible for libblkid are erased. In this case the wipefs scans the device again after each modification (erase) until no magic string is found. Note that by default wipefs does not erase nested partition tables on non-whole disk devices. For this the option --force is required. OPTIONS
-a, --all Erase all available signatures. The set of erased signatures can be restricted with the -t option. -b, --backup Create a signature backup to the file $HOME/wipefs-<devname>-<offset>.bak. For more details see the EXAMPLES section. -f, --force Force erasure, even if the filesystem is mounted. This is required in order to erase a partition-table signature on a block device. -h, --help Display help text and exit. -J, --json Use JSON output format. -n, --noheadings Do not print a header line. -O, --output list Specify which output columns to print. Use --help to get a list of all supported columns. -n, --no-act Causes everything to be done except for the write() call. -o, --offset offset Specify the location (in bytes) of the signature which should be erased from the device. The offset number may include a "0x" pre- fix; then the number will be interpreted as a hex value. It is possible to specify multiple -o options. The offset argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. -p, --parsable Print out in parsable instead of printable format. Encode all potentially unsafe characters of a string to the corresponding hex value prefixed by 'x'. -q, --quiet Suppress any messages after a successful signature wipe. -t, --types list Limit the set of printed or erased signatures. More than one type may be specified in a comma-separated list. The list or individ- ual types can be prefixed with 'no' to specify the types on which no action should be taken. For more details see mount(8). -V, --version Display version information and exit. EXAMPLES
wipefs /dev/sda* Prints information about sda and all partitions on sda. wipefs --all --backup /dev/sdb Erases all signatures from the device /dev/sdb and creates a signature backup file ~/wipefs-sdb-<offset>.bak for each signature. dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb seek=$((0x00000438)) bs=1 conv=notrunc Restores an ext2 signature from the backup file ~/wipefs-sdb-0x00000438.bak. AUTHOR
Karel Zak <kzak@redhat.com> ENVIRONMENT
LIBBLKID_DEBUG=all enables libblkid debug output. SEE ALSO
blkid(8), findfs(8) AVAILABILITY
The wipefs command is part of the util-linux package and is available from https://www.kernel.org/pub/linux/utils/util-linux/. util-linux December 2014 WIPEFS(8)
All times are GMT -4. The time now is 08:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy