Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support How to use read the char * from file? Post 302773475 by zigizag on Thursday 28th of February 2013 03:33:20 AM
Old 02-28-2013
How to use read the char * from file?

i have a file 1.txt. the file contains:
* server1.com : ewf,wefwef,wef,wef
-------------------------------------
* server2.com : ewf,wefwef,wef,wef
-------------------------------------
* server3.com : ewf,wefwef,wef,wef
-------------------------------------

how can i read * ? from the start of the line?

the is the code
Code:
#!/bin/bash

while read line
do
[[ "$line" =~ ^*server1.com ]] && url=${line##*: }

done < 1.txt

for U in ${url//,/ }
do
printf "http://$U.com\n"
done

it doesnt work...........
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need shell script to get last 10 char from a file name and write in to a new file

i have no idea abount shell script but i need need shell script to get last 10 char from a file name and write in to a new file. consider u hav 5 files in a particular dir i script should get last 10 char of each file n write the 10 char in separate files (2 Replies)
Discussion started by: raj0390
2 Replies

2. Shell Programming and Scripting

How to replace any char with newline char.

Hi, How to replace any character in a file with a newline character using sed .. Ex: To replace ',' with newline Input: abcd,efgh,ijkl,mnop Output: abcd efgh ijkl mnop Thnx in advance. Regards, Sasidhar (5 Replies)
Discussion started by: mightysam
5 Replies

3. Programming

Adding a single char to a char pointer.

Hello, I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it: char* getext(char *file) { char *extension; int i, j;... (5 Replies)
Discussion started by: pallak7
5 Replies

4. Shell Programming and Scripting

Rename file last char

I want to rename the file from below format to ABCDEFCGHF20090112345623.DAT to ABCDEFCGHF20090112345624.DAT the last digit before dot to increment to 1. if it 9 should become 0 How to do this in simple way? (2 Replies)
Discussion started by: svenkatareddy
2 Replies

5. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

6. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Programming

Invalid conversion from char* to char

Pointers are seeming to get the best of me and I get that error in my program. Here is the code #include <stdio.h> #include <stdlib.h> #include <string.h> #define REPORTHEADING1 " Employee Pay Hours Gross Tax Net\n" #define REPORTHEADING2 " Name ... (1 Reply)
Discussion started by: Plum
1 Replies

9. UNIX for Advanced & Expert Users

File command return wrong filetype while file holds group separator char.

hi, I am trying to get the FileType using the File command. I have one file, which holds Group separator along with ASCII character. It's a Text file. But when I ran the File command the FileType is coming as "data". It should be "ASCII, Text file". Is the latest version of File... (6 Replies)
Discussion started by: Arpitak29
6 Replies

10. UNIX for Beginners Questions & Answers

Substitute particular char in a file

I have a file like this. 1 aaa bcd 1 56 xyz 1 2 ccc rrr 1 25 512 1 1 zaz eee 1 55 511 1 I want to change middle 1's ie after bcd,rrr,eee to 0 where as other 1's should not change. Can you please provide a solution . (5 Replies)
Discussion started by: kshari8888
5 Replies
xmount(1)							      xmount								 xmount(1)

NAME
xmount - Tool to crossmount between multiple input and output harddisk image files SYNOPSIS
xmount [[fopts] [mopts]] <ifile> [<ifile> [...]] <mntp> DESCRIPTION
xmount allows you to convert on-the-fly between multiple input and output harddisk image types. xmount creates a virtual file system using FUSE (Filesystem in Userspace) that contains a virtual representation of the input image. The virtual representation can be in raw DD, Vir- tualBox's virtual disk file format, Microsoft's Virtual Hard Disk Image format or in VmWare's VMDK file format. Input images can be raw DD, EWF (Expert Witness Compression Format) or AFF (Advanced Forensic Format) files. In addition, xmount also supports virtual write access to the output files that is redirected to a cache file. This makes it possible to boot acquired harddisk images using QEMU, KVM, VirtualBox, VmWare or alike. OPTIONS
fopts: (Options specific to FUSE) -d: Enable FUSE's and xmount's debug mode. -h: Display this help message. -s: Run single threaded. -o no_allow_other: Disable automatic addition of FUSE's allow_other option. -o <fmopts> : Specify fuse mount options. Will also disable automatic addition of FUSE's allow_other option! INFO: For VMDK emulation, you have to uncomment "user_allow_other" in /etc/fuse.conf or run xmount as root. mopts: (Options specific to xmount) --cache <file> : Enable virtual write support and set cachefile to use. --in <type> : Specify input image type. Type can be "dd" or "ewf". --info : Print out some infos about used compiler and libraries. --out <type> : Specify output image type. Type can be "dd", "vdi", "vhd", "vmdk(s)". --owcache <file> : Same as --cache <file> but overwrites existing cache. --rw <cache_file> : Same as --cache. --version : Same as --info. INFO: Input and output image type defaults to "dd" if not specified. ifile: Input image file. If you use EWF files, you have to specify all image segments! (If your shell supports it, you can use .E?? as file extension to specify them files) mntp: Mount point where virtual files should be located. BUGS
Hopefully none. If you find any, please e-mail to <bugs@pinguin.lu>. EXAMPLE
To xmount an EWF image from your acquired disk as a raw DD image under /mnt, use the following command: xmount --in ewf ./acquired_disk.E?? /mnt To xmount the same ewf image as vdi file, you would use a command like this: xmount --in ewf --out vdi ./acquired_disk.E?? /mnt And to enable virtual write support on a raw DD input image xmounted as VDI file: xmount --out vdi --cache ./acquired_disk.cache ./acquired_disk.dd /mnt Gillen Daniel May 9, 2012 xmount(1)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy